Tuesday, November 9, 2010

Windows: Start or Stop a Service on remote server using wmic

WMIC has been a built-in command since XP as a interface to WMI operations. Here is a basic task , stop or start the windows service on remote server.

Run WMIC on command prompt, or Run box.

By default, the WMIC connect to local WMI service. If you want to connect to a remote Node.

/Node:yourremote Server
enter you password.

When you run /? , you will be able to see all the built-in Objects that you can interact with.


Service List, it will show you all services installed on the server

If you want to list only those service a running, and list the name caption only (like the sql projection syntax. )

service where state=”running” get name, caption, status

get a specified service status, like iisadmin


If you want to control the service, like stop the service or restart the service. 

to list all the operation on the service ,
Service where name=”iisadmin” call

the same approach applies to the process management.

process where name=”notepad.exe” call terminate
close the notepad.exe process
to shutdown the server
terminate the winlogon.exe

Also you can use PSexec to run process on the remote server directly. http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx


kristinahojholt said...

I like what you guys tend to be up too. Such clever work and coverage! Keep up the awesome works guys I've you guys to my blogroll. network support Virginia

jesi k said...

Decent post. I simply stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. In any manner I will be subscribing to your feed and I hope you post again soon.mac repair Virginia

Nikolay ebardeev said...

Youre so cool! I dont suppose Ive read something like this before. So good to find somebody with some authentic ideas on this subject. realy thanks for starting this up. this website is one thing that is needed on the net, somebody with a bit of originality. useful job for bringing something new to the internet! online casino games

Locations of visitors to this page