Starting,Stopping and Restarting Remote Services with PowerShell

Learn Powershell | Achieve More

A common task that a System Administrator might face in their day is restarting a service on a remote system. While this can be accomplish using the Services.MSC or another various GUI, you have to load the GUI, then connect to the remote system, locate the service and finally perform the action on the service.

There are a few ways that this can be done using WMI (Win32_Services) and using Get-Service along with Stop/Start/Restart-Service cmdlets.

Using WMI

The first method of managing a service that I will go into is using WMI to accomplish this task. First I will connect to the specific service that I want to manipulate, in this case, the windows update client service: wuauserv.

$service = Get-WmiObject -ComputerName DC1 -Class Win32_Service `
-Filter "Name='wuauserv'"
$service

image

We now have our WMI service object for wuauserv. Lets take a look at all of the available methods for…

View original post 721 more words

Advertisements

PowerShell Cheat Sheet

rambling cookie monster

March 2015 EDIT:  Updated list of resources is available here.

I’m working on compiling a cheat sheet or two for PowerShell.  Why would I do this when so many exist?  No idea.  Is it messy and might it overlook important details?  Absolutely!  If you have any suggestions they would be greatly appreciated.

I would like to acknowledge the following sources which came in quite handy when putting the cheat sheets together.  If you haven’t already, you may want to bookmark/download/purchase these!  They will come in handy regardless of the cheat sheets you use or commands you memorize

View original post 132 more words