Link to home
Start Free TrialLog in
Avatar of SCCMUser
SCCMUserFlag for India

asked on

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
Avatar of wizzie83
wizzie83

use the following script:

@echo off
net stop "Windows Management Instrumentation"
net stop "SMS Agent Host"
Avatar of Lee W, MVP
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
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.
net STOP /y winmgmt

It will stop the service without waiting for a prompt... default will be taken as "Yes"
Avatar of SCCMUser

ASKER

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
net STOP /y winmgmt
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.
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

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

somefile.vbs "Batch_File_Path"
ASKER CERTIFIED SOLUTION
Avatar of wizzie83
wizzie83

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks, it worked
oh... no split up :( .... anyway...!!!!