NT service (setting Description string)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Larry Bates

    NT service (setting Description string)

    Anybody know what variable I need to define in my
    class to set the long description that shows up
    in the Services control panel applet?

    _svc_name_ holds the short name
    _svc_display_na me_ holds the long name
    _svc_?????_ holds the description

    Thanks, Larry


  • Thomas Heller

    #2
    Re: NT service (setting Description string)

    "Larry Bates" <lbates@swamiso ft.com> writes:
    [color=blue]
    > Anybody know what variable I need to define in my
    > class to set the long description that shows up
    > in the Services control panel applet?
    >
    > _svc_name_ holds the short name
    > _svc_display_na me_ holds the long name
    > _svc_?????_ holds the description[/color]

    There isn't any yet. Apparently you have to call the win32 api
    ChangeServiceCo nfig2() (but maybe it can also be done with the wmi
    module).

    Thomas


    Comment

    • Larry Bates

      #3
      Re: NT service (setting Description string)

      I found a way to do this that seems to make
      sense. You can modify the Description in
      the registry using _winreg. The value
      is located at:

      HMLM\SYSTEM\Cur rentControlSet\ Services\<servi cename>

      I then installed the code below in the main
      program of the service (that gets executed
      when the service is installed). This way
      the registry gets "fixed" every time the
      service is installed or removed. Seems to
      work pretty well.

      Thanks for the input from everyone.

      Larry Bates


      if __name__ == "__main__":
      import sys
      import _winreg
      #
      # Following line handles install/remove/start/stop commands from the
      command line
      #
      win32serviceuti l.HandleCommand Line(AFRservice )
      try: cmd=sys.argv[1].upper()
      except: sys.exit()

      if cmd == 'INSTALL':
      print "Calling win32evtlogutil .AddSourceToReg istry for AFR
      Application"

      win32evtlogutil .AddSourceToReg istry('AFR','C: \Python22\Lib\s ite-Packages\win
      32\servicemanag er.pyd',
      'Application')

      #
      # Update the description of this service in the registry
      #

      #---------------------------------------------------------------------
      # Open registry at the proper key

      #---------------------------------------------------------------------
      regkey='SYSTEM\ CurrentControlS et\Services\AFR '
      key=_winreg.Ope nKey(_winreg.HK EY_LOCAL_MACHIN E, regkey, 0,
      _winreg.KEY_SET _VALUE)
      description='AF R provides automated routing for inbound faxes that
      are ' \
      'received by Castelle Faxpress fax server. Faxes are
      converted ' \
      'to .PDF files and routed via SMTP email to users based
      on ' \
      'routing rules.'

      _winreg.SetValu eEx(key, 'Description', 0, _winreg.REG_SZ,
      description)

      elif cmd == 'REMOVE':
      print "Calling win32evtlogutil .RemoveSourceFr omRegistry for AFR
      Application"
      win32evtlogutil .RemoveSourceFr omRegistry('AFR ','Application' )

      "Larry Bates" <lbates@swamiso ft.com> wrote in message
      news:jJmdnfpaDe wojtjdRVn-sQ@comcast.com. ..[color=blue]
      > Anybody know what variable I need to define in my
      > class to set the long description that shows up
      > in the Services control panel applet?
      >
      > _svc_name_ holds the short name
      > _svc_display_na me_ holds the long name
      > _svc_?????_ holds the description
      >
      > Thanks, Larry
      >
      >[/color]


      Comment

      Working...