How do start/stop a service? 
Author Message
 How do start/stop a service?

Hi folks,

does anybody knows how to start and stop a service under Windows NT 4 using
a script?

Thanks in advance.
Gert Thiel.



Tue, 03 Apr 2001 03:00:00 GMT  
 How do start/stop a service?
Where did you get this information?  There seems to be all sorts of
objects that I can create that I don't know about.  It's not in the
VBScript docs that I downloaded.  Also, what is "browser" in
"GetObject("WinNT://Your_Computer_Name/browser")"?  I would like to
use this code, too, but I'm not sure what you're getting at here.
Where do you actually specify what service whose status you are
interested in?

Thanks!!

Carla Gaskins

On Fri, 16 Oct 1998 09:30:40 -0500, "Clarence Washington Jr."

Quote:

>Try this script. Depending on the status of the service (Started, Stopped, or Paused) It will perform the appropriate action on the browser service.

>Set BrowserServiceObj = GetObject("WinNT://Your_Computer_Name/browser")

>Select Case cstr(BrowserServiceObj.status)
>     Case "1"
>        BrowserServiceObj.start
>     Case "4"
>        BrowserServiceObj.stop
>     Case "7"
>        BrowserServiceObj.continue
>End Select

>1 = Stopped or disabled
>4 = Started
>7 = Paused

>Clarence

>There are several Vbscript sample (almost 50 vbscript samples) on my site to download and learn from. Check it out.

>Check it out
>http://cwashington.netreach.net

>Win32 bit scripting. Everything you need to get up and running,
>A script repository containing almost 100 sample scripts,
>downloads, reference files, and technical support via an
>online discussion forum.


>Hi folks,

>does anybody knows how to start and stop a service under Windows NT 4 using
>a script?

>Thanks in advance.
>Gert Thiel.




Tue, 03 Apr 2001 03:00:00 GMT  
 How do start/stop a service?

You first have to have ADSI (Active Directory Services Interfaces) Installed

Actually for the code to be more efficient the line should read
Set BrowserServiceObj = GetObject("WinNT://Your_Computer_Name/browser", service)

browser is the short name for the browser service on NT. With ADSI, a service is an object in the computer container just as a user is an object in the domain container.

You can get adsi at http://www.microsoft.com/ntserver/downloads Get the latest version 2.5 beta. Although its in beta it seems to be pretty stable. I haven't had any problems so far.

Clarence

Check it out
http://cwashington.netreach.net

Win32 bit scripting. Everything you need to get up and running,
A script repository containing almost 100 sample scripts,
downloads, reference files, and technical support via an
online discussion forum.

Where did you get this information?  There seems to be all sorts of
objects that I can create that I don't know about.  It's not in the
VBScript docs that I downloaded.  Also, what is "browser" in
"GetObject("WinNT://Your_Computer_Name/browser")"?  I would like to
use this code, too, but I'm not sure what you're getting at here.
Where do you actually specify what service whose status you are
interested in?

Thanks!!

Carla Gaskins

On Fri, 16 Oct 1998 09:30:40 -0500, "Clarence Washington Jr."

Quote:

>Try this script. Depending on the status of the service (Started, Stopped, or Paused) It will perform the appropriate action on the browser service.

>Set BrowserServiceObj = GetObject("WinNT://Your_Computer_Name/browser")

>Select Case cstr(BrowserServiceObj.status)
>     Case "1"
>        BrowserServiceObj.start
>     Case "4"
>        BrowserServiceObj.stop
>     Case "7"
>        BrowserServiceObj.continue
>End Select

>1 = Stopped or disabled
>4 = Started
>7 = Paused

>Clarence

>There are several Vbscript sample (almost 50 vbscript samples) on my site to download and learn from. Check it out.

>Check it out
>http://cwashington.netreach.net

>Win32 bit scripting. Everything you need to get up and running,
>A script repository containing almost 100 sample scripts,
>downloads, reference files, and technical support via an
>online discussion forum.


>Hi folks,

>does anybody knows how to start and stop a service under Windows NT 4 using
>a script?

>Thanks in advance.
>Gert Thiel.




Tue, 03 Apr 2001 03:00:00 GMT  
 How do start/stop a service?
Thank you, Dain Perkins, for helping me.  I used:

Set BrowserServiceObj = GetObject("WinNT://computer_name/ADSM Central
Scheduler Service,Service")

and then BrowserServiceObj.status.  Adding the ",Service" (make sure
there isn't a space between the comma and "Service"!) part speeded it
up by almost 10 seconds!  This works, too, with creating user objects.
Just put ",User" at the end instead of ",Service".  

Thanks!

Carla



Quote:
>Where did you get this information?  There seems to be all sorts of
>objects that I can create that I don't know about.  It's not in the
>VBScript docs that I downloaded.  Also, what is "browser" in
>"GetObject("WinNT://Your_Computer_Name/browser")"?  I would like to
>use this code, too, but I'm not sure what you're getting at here.
>Where do you actually specify what service whose status you are
>interested in?

>Thanks!!

>Carla Gaskins

>On Fri, 16 Oct 1998 09:30:40 -0500, "Clarence Washington Jr."

>>Try this script. Depending on the status of the service (Started, Stopped, or Paused) It will perform the appropriate action on the browser service.

>>Set BrowserServiceObj = GetObject("WinNT://Your_Computer_Name/browser")

>>Select Case cstr(BrowserServiceObj.status)
>>     Case "1"
>>        BrowserServiceObj.start
>>     Case "4"
>>        BrowserServiceObj.stop
>>     Case "7"
>>        BrowserServiceObj.continue
>>End Select

>>1 = Stopped or disabled
>>4 = Started
>>7 = Paused

>>Clarence

>>There are several Vbscript sample (almost 50 vbscript samples) on my site to download and learn from. Check it out.

>>Check it out
>>http://cwashington.netreach.net

>>Win32 bit scripting. Everything you need to get up and running,
>>A script repository containing almost 100 sample scripts,
>>downloads, reference files, and technical support via an
>>online discussion forum.


>>Hi folks,

>>does anybody knows how to start and stop a service under Windows NT 4 using
>>a script?

>>Thanks in advance.
>>Gert Thiel.




Tue, 03 Apr 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Starting, stopping and pauseing a service.

2. Problems with stopping/starting service

3. How to start/stop services with vbscript?

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

5. How to start/stop a NT service

6. start and stop services

7. login script to start/stop service

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