You can use the following PowerShell script to Start, Stop, Enable or Disable Windows services on a remote machine. An input file can be used to provide the computer names.
Updated Script - http://portal.sivarajan.com/2010/07/stopstart-or-enabledisable-service_26.html










6 comments:
Hi Santhosh,
I'm from Brazil and i need to start mom service in more than 300 machine after patched them.
I'm new in scripts so, if i save this line as txt file and a csv file. That's all i need?
Thanks
This is a PowerShell script so you need to rename the txt file extension to .PS1
Input.csv file contains all computer names.
Also, I have updated script on the following location. You can enter additional credentials if needed.
http://portal.sivarajan.com/2010/07/stopstart-or-enabledisable-service_26.html
Hi Siva,
This is Sunil from Toronto, need help in writing a script
1. Services to be stopped and upon completion need to create a file (services stopped) in a folder i point (Stop).
2. Also need to automatically start the services up on reading a file (Services started)in a folder i point (Start)
Is this possible? help me.
Take a look at the following updated script.
http://portal.sivarajan.com/2011/05/stop-start-disable-service.html
I must be doing something wrong when I use your scripts.
I changed the $service = "regsvc"
I removed the first two green lines since I'm waiting to start the service.
Also, when I first ran the script I received an error "Cannont validate argument on parameter 'ComputerName'. So I assumed I had to put ComputerName as the heading in the input.csv.
When I re-ran the script I get the following error "The RPC server is unavailable". (Line 9 char: 16)
Then I noticed you updated the script to add the credentials.
I still got the above error, plus "You cannot call a method on a null-valued expression"
So I must be doing something extremely wrong!
Please help.
Thanks
Yes. The header must be ComtuterName.
>> The RPC server is unavailable
Sounds like script can’t access the remote computer. Can you browse \\computer\admin$? If not, you won’t be able to manage this computer remotely.
Post a Comment