I would really recommend Win32::Lanman, also. WMI is great but it is very
expensive (processing time, memory overhead, etc). 

-----Original Message-----
From: Timothy Johnson [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, October 02, 2002 9:48 AM
To: 'Patrick J. LoPresti'; Dave Roth
Cc: [EMAIL PROTECTED]
Subject: RE: Disabling a service



Nice.  Although if there is still anyone out there that does not have
Win32::Lanman installed on their system, get thee to a repository and
download it. It's your basic one-stop shop for almost everything Win32
administration related.

-----Original Message-----
From: Patrick J. LoPresti [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 02, 2002 9:00 AM
To: Dave Roth
Cc: [EMAIL PROTECTED]
Subject: Re: Disabling a service


Dave Roth <[EMAIL PROTECTED]> writes:

> You really should avoid modifying the Registry directly for these 
> reason. If Windows changes the location of this information (think in 
> terms of how IIS moved their configuration from the Registry to their 
> metabase) your script will break.

Good point.

> You should use the proper Win32 APIs (Win32::Service, Win32::Lanman, 
> Win32::Daemon, etc).

Yeah, but I hate downloading random modules.

As it turns out, there is another interface which Microsoft is pretty much
guaranteed to support forever:

    http://msdn.microsoft.com/library/en-us/wmisdk/wmi/win32_service.asp

You have to have WMI, which means Windows 2000 or XP (although you can
download it for NT).

Using this interface, I have rewritten my script:

 
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/unattended/unattended/install
/bin/startup-type.pl?rev=HEAD&content-type=text/vnd.viewcvs-markup

This version lets you use either the unique identifier or the "display name"
to refer to the service, and it is case-insensitive.  So you can say this:

    startup-type.pl automatic iisadmin

...or this:

    startup-type.pl Automatic "IIS Admin Service"

The script is also a decent example of how to use WMI, via which you can
enumerate and configure quite a few things.

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

Reply via email to