Skip to main content

Posts

Showing posts with the label Service

Remotely Set State and StartMode of a Service using PowerShell

Well as the name suggests this is a very simple and straightforward post. Most of the PowerShell Geeks out there already know that we can do it in various ways: Using Set-Service Using PSRemoting Using WMI (Win32_Service) In our environment at office we don't have PSRemoting yet enabled, but it's okey we can come around that. In addition would like it to be PowerShell v2 compatible you never know who asks you for this Script running on v2. We can use Set-Service which has - ComputerName parameter, in case you haven't checked. But it fails to start/ stop a remote service if there are dependent services. C:\> gsv -Name bits -ComputerName DexterClient1 Status Name DisplayName ------ ---- ----------- Running bits Background Intelligent Transfer Ser... C:\> Set-Service -Name BITS -Status Stopped -ComputerName DexterClient1 -Verbose VERBOSE: Performing the operation "Set-Service" on target "Bac...