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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
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
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

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
wizzie83Commented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SCCMUserAuthor Commented:
Thanks, it worked
0
milindsmCommented:
oh... no split up :( .... anyway...!!!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.