Batch file to stop some services

Hello, I need a batch file in stopping the following services:

1) Windows Management Instrumentation
2) SMS Agent Host


Please help
SCCMUserAsked:
Who is Participating?
 
wizzie83Connect With a Mentor Commented:
Exactly what milindsm said.
Depending on where you saved both the vbs en batch file.

for example: c:\starter.vbs c:\script\stopservices.bat
0
 
wizzie83Commented:
use the following script:

@echo off
net stop "Windows Management Instrumentation"
net stop "SMS Agent Host"
0
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
To stop WMI, you can use:
NET STOP WINMGMT

I'm not familiar with the SMS Agent Host (I don't have SMS/SCCM installed on my network yet).  Go to the Services Administrative tool and open the properties of the service in question - look for the service name (see image below- at the top of the general tab) - then run the command NET STOP with the service name (in the same format as the WMI service)

You can also use SC -

SC STOP WINMGMT
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
wizzie83Commented:
The full service name between " " will work.
Use net start to find all the services also.
If you use the names stated there it will work.
0
 
milindsmCommented:
net STOP /y winmgmt

It will stop the service without waiting for a prompt... default will be taken as "Yes"
0
 
SCCMUserAuthor Commented:
thanks. Can you tell me how to run it silently? I don't want a prompt asking me to click on a yes or no
0
 
milindsmCommented:
net STOP /y winmgmt
0
 
SCCMUserAuthor Commented:
Folks, my batch script is as follows:

@echo off
net stop /y "Windows Management Instrumentation"
net stop /y "SMS Agnet Host"

I am not getting the prompt for a y/n. So thanks fellows. However I am still getting the black screen which is actually telling me that it is stopping the services. Is there a way that I can stop the screen to come up? I just want the script to run silently.
0
 
wizzie83Commented:
Creating a starter.vbs file.

start the batchfile with starter.vbs [batchfilename]
CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False

Open in new window

0
 
SCCMUserAuthor Commented:
Wizzie, I did not understand. I created a .vbs file with the code mentioned by you. Now, how do i go ahead?
0
 
milindsmCommented:
go to command prompt..... n type

somefile.vbs "Batch_File_Path"
0
 
SCCMUserAuthor Commented:
Thanks, it worked
0
 
milindsmCommented:
oh... no split up :( .... anyway...!!!!
0
All Courses

From novice to tech pro — start learning today.