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\CurrentControlSet\Services\<servicename>
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
#
win32serviceutil.HandleCommandLine(AFRservice)
try: cmd=sys.argv[1].upper()
except: sys.exit()
if cmd == 'INSTALL':
print "Calling win32evtlogutil.AddSourceToRegistry for AFR
Application"
win32evtlogutil.AddSourceToRegistry('AFR','C:\Python22\Lib\site-Packages\win
32\servicemanager.pyd',
'Application')
#
# Update the description of this service in the registry
#
#---------------------------------------------------------------------
# Open registry at the proper key
#---------------------------------------------------------------------
regkey='SYSTEM\CurrentControlSet\Services\AFR'
key=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, regkey, 0,
_winreg.KEY_SET_VALUE)
description='AFR 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.SetValueEx(key, 'Description', 0, _winreg.REG_SZ,
description)
elif cmd == 'REMOVE':
print "Calling win32evtlogutil.RemoveSourceFromRegistry for AFR
Application"
win32evtlogutil.RemoveSourceFromRegistry('AFR','Application')