login script to start/stop service 
Author Message
 login script to start/stop service

My loginscript (VBScript) contains code to start or stop a service on the
local machine. But it only works for Administrators. Power Users get an
access denied "80070005" at line "If Service.Status = 4 then". Power Users
can log in and start/stop this service manually from Computer Manager (Win
2000). Anyone have any ideas?

Here's that piece of the script...
---begin vbscript

Set Service = GetObject("WinNT://IBM/Big-Blue/ChessPlayr,Service")
if Service.Status = 4 then
   Service.Stop
end if

---end vbscript



Sun, 22 Aug 2004 05:00:17 GMT  
 login script to start/stop service

Quote:

> My loginscript (VBScript) contains code to start or stop a service on the
> local machine. But it only works for Administrators. Power Users get an
> access denied "80070005" at line "If Service.Status = 4 then". Power Users
> can log in and start/stop this service manually from Computer Manager (Win
> 2000). Anyone have any ideas?

> Here's that piece of the script...
> ---begin vbscript

> Set Service = GetObject("WinNT://IBM/Big-Blue/ChessPlayr,Service")
> if Service.Status = 4 then
>    Service.Stop
> end if

Hi

Can your Power Users use "Net stop <service name> successfully?

--
torgeir



Sun, 22 Aug 2004 06:25:44 GMT  
 login script to start/stop service
Yes, Net Start <service name> and Net Stop <service name> both work as Power
User - no problem. I suppose I could use that in the script...Hmm. Not an
elegant solution, but worth trying. Thanks.

Henry


Quote:

> > My loginscript (VBScript) contains code to start or stop a service on
the
> > local machine. But it only works for Administrators. Power Users get an
> > access denied "80070005" at line "If Service.Status = 4 then". Power
Users
> > can log in and start/stop this service manually from Computer Manager
(Win
> > 2000). Anyone have any ideas?

> > Here's that piece of the script...
> > ---begin vbscript

> > Set Service = GetObject("WinNT://IBM/Big-Blue/ChessPlayr,Service")
> > if Service.Status = 4 then
> >    Service.Stop
> > end if

> Hi

> Can your Power Users use "Net stop <service name> successfully?

> --
> torgeir



Sun, 22 Aug 2004 06:43:25 GMT  
 login script to start/stop service

Quote:

> Yes, Net Start <service name> and Net Stop <service name> both work as Power
> User - no problem. I suppose I could use that in the script...Hmm. Not an
> elegant solution, but worth trying.

I don't know if you know this, but adding 0 as the second parameter to the Run
method, it will hide the "ugly" command promp window that Net Start/Stop
creates. This makes it almost elegant, at least ;-)

Set oWSHShell=WScript.CreateObject("WScript.Shell")
sServiceName = "iclicsrv"

oWSHShell.Run "Net Start " & sServiceName, 0, True

--
torgeir



Sun, 22 Aug 2004 08:39:00 GMT  
 login script to start/stop service
Cool! I didn't know that. I might like this solution better than my original
one. But I still can't help wondering why the getObject method doesn't
work...oh well, no matter.

Henry


...

Quote:
> I don't know if you know this, but adding 0 as the second parameter to the
Run
> method, it will hide the "ugly" command promp window that Net Start/Stop
> creates. This makes it almost elegant, at least ;-)

> Set oWSHShell=WScript.CreateObject("WScript.Shell")
> sServiceName = "iclicsrv"

> oWSHShell.Run "Net Start " & sServiceName, 0, True

> --
> torgeir



Sun, 22 Aug 2004 23:36:40 GMT  
 login script to start/stop service
What does the third parameter (, True) do?

Thanks,

Tom


Quote:
> I don't know if you know this, but adding 0 as the second parameter to the
Run
> method, it will hide the "ugly" command promp window that Net Start/Stop
> creates. This makes it almost elegant, at least ;-)

> Set oWSHShell=WScript.CreateObject("WScript.Shell")
> sServiceName = "iclicsrv"

> oWSHShell.Run "Net Start " & sServiceName, 0, True



Sat, 18 Sep 2004 03:19:06 GMT  
 login script to start/stop service
makes it wait for net start to complete it's task then continues execution
of the script. but in this case, if it's the last line in the script, i
don't see what it;s waiting for.

--
Dr.X

Quote:
> What does the third parameter (, True) do?

> Thanks,

> Tom



> > I don't know if you know this, but adding 0 as the second parameter to
the
> Run
> > method, it will hide the "ugly" command promp window that Net
Start/Stop
> > creates. This makes it almost elegant, at least ;-)

> > Set oWSHShell=WScript.CreateObject("WScript.Shell")
> > sServiceName = "iclicsrv"

> > oWSHShell.Run "Net Start " & sServiceName, 0, True



Sat, 18 Sep 2004 03:28:45 GMT  
 login script to start/stop service
You may want to grab the WSH documentation; that's part of the description of the Run method:

http://download.microsoft.com/download/winscript56/Install/5.6/W982KM...

Quote:

> What does the third parameter (, True) do?

> Thanks,

> Tom



> > I don't know if you know this, but adding 0 as the second parameter to the
> Run
> > method, it will hide the "ugly" command promp window that Net Start/Stop
> > creates. This makes it almost elegant, at least ;-)

> > Set oWSHShell=WScript.CreateObject("WScript.Shell")
> > sServiceName = "iclicsrv"

> > oWSHShell.Run "Net Start " & sServiceName, 0, True



Sat, 18 Sep 2004 04:13:46 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Script To Stop/Start NT Service

2. Starting, stopping and pauseing a service.

3. Problems with stopping/starting service

4. How to start/stop services with vbscript?

5. START/STOP/ displayed Services running on PC thu an ASP page

6. How to start/stop a NT service

7. start and stop services

8. stop/start a service in VBS

9. Stop and Starting Services on NT

10. Starting and Stopping NT Services with ADSI,wsh, and VBScript

11. Start/Stop a NT Service using wsh/adsi

12. Starting and stopping Services from ASP or VBS

 

 
Powered by phpBB® Forum Software