----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 29, 2001 9:39 AM
Subject: changing service config


> I'm trying to use perl to change the config of an existing service on an
nt
> box. For a test, I'm trying to change the startup of the schedule service
> on my machine from manual to automatic. I have admin access.
> I tried the following 2 snippets, one using win32::daemon, and one using
> win32::lanman. Both say they completed successfully, but when I check the
> status of the service in control panel, its still set to manual start.
> Anyone see something I might be missing??
> Thanks for any advice.
> Chris
>
>
> use Win32::Daemon;
>
> %ServiceConfig = (
>    name => 'Schedule',
>    start => 'Automatic',
>    machine => "\\\\".Win32::NodeName,
>     );
> if (Win32::Daemon::ConfigureService( \%ServiceConfig ))
> {
>    print "service $ServiceConfig{name} successfully reconfigured\n";
> }
> else
> {
>    print "It bombed\n";
> }


Try  -  %ServiceConfig = ( name => 'Schedule',  start => '2',   machine =>
"\\\\".Win32::NodeName );


> ########################
> use Win32::Lanman;
>
> if(!Win32::Lanman::ChangeServiceConfig("\\\\cchupela", '', 'Schedule', {
> startup => 'automatic'}))
>  {
>         print "Sorry, something went wrong; error: ";
>         # get the error code
>         print Win32::Lanman::GetLastError();
>         exit( 1 );
>  }
>  else
>  {
>     print "it worked\n";
>  }
>

Try -  if(!Win32::Lanman::ChangeServiceConfig("\\\\cchupela", '',
'Schedule', {startup => '2'}))



_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin

Reply via email to