NT service (setting Description string)
Phipps Xue
phipps.xue at sap.com
Thu Mar 4 05:11:15 EST 2004
Where to get modules for WMT?
Phipps
"Tim Golden" <tim.golden at viacom-outdoor.co.uk> wrote in message
news:mailman.7.1078305889.727.python-list at python.org...
> >From: Thomas Heller [mailto:theller at python.net]
> >"Larry Bates" <lbates at swamisoft.com> writes:
> >
> >> 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_name_ holds the long name
> >> _svc_?????_ holds the description
> >
> >There isn't any yet. Apparently you have to call the win32 api
> >ChangeServiceConfig2() (but maybe it can also be done with the wmi
> >module).
> >
> >Thomas
>
> Haven't tried it myself, but the Win32_Service WMI class does
> sport a Change method with the following signature:
>
> uint32 Change(
> string DisplayName,
> string PathName,
> uint32 ServiceType,
> uint32 ErrorControl,
> string StartMode,
> boolean DesktopInteract,
> string StartName,
> string StartPassword,
> string LoadOrderGroup,
> string LoadOrderGroupDependencies,
> string ServiceDependencies
> );
>
> All right; I did try it. It works:
>
> <screendump>
>
> ActivePython 2.2.3 Build 227 (ActiveState Corp.) based on
> Python 2.2.3 (#42, Nov 13 2003, 09:57:55) [MSC 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import wmi
> >>> c = wmi.WMI ()
> >>> for service in c.Win32_Service (Name="dnscache"): print service.Name,
> service.DisplayName
> ...
> Dnscache DNS Client
> >>> service.Change (DisplayName="New DNS Client")
> (<win32com.gen_py.Microsoft WMI Scripting V1.1 Library.ISWbemProperty
> instance at 0x13968496>,)
> >>> for service in c.Win32_Service (Name="dnscache"): print service.Name,
> service.DisplayName
> ...
> Dnscache New DNS Client
> >>>
>
> </screendump>
>
> TJG
>
> ________________________________________________________________________
> This e-mail has been scanned for all viruses by Star Internet. The
> service is powered by MessageLabs. For more information on a proactive
> anti-virus service working around the clock, around the globe, visit:
> http://www.star.net.uk
> ________________________________________________________________________
>
More information about the Python-list
mailing list