"John Serink" <[EMAIL PROTECTED]> writes:

> Way, way easier to do it in the registry.

Um, no.  With WMI it is three lines:

  use Win32::OLE;
  my $service = Win32::OLE->GetObject ('WinMgmts:Win32_Service.Name="W3SVC"');
  $service->ChangeStartMode ('Manual');

...done.  Replace "W3SVC" with the service name of your choice.  See
<http://msdn.microsoft.com/library/en-us/wmisdk/wmi/win32_service.asp>
for complete documentation on the Win32_Service class.

> Small subroutine to do it on a remote machine.

Remote machine?  OK, four lines:

  use Win32::OLE;
  my $service = Win32::OLE->GetObject
    ('WinMgmts://client-host/root/cimv2:Win32_Service.Name="W3SVC"');
  $service->ChangeStartMode ('Manual');

Replace "client-host" with the host's name.

True, my startup-type.pl script is more than four lines.  But it is
case-insensitive, it accepts either the short name ("W3SVC") or the
display name ("World Wide Web Publishing Service"), it bombs out
noisily if any errors occur, and it responds to "--help" with full
documentation.

If you are like Dave and just cannot stomach burning 10000 times more
CPU cycles than necessary, then use one of his modules.  But never
hack the registry directly if you can possibly avoid it.

 - Pat
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to