Just a small script to restart a list of Windows-services (download here). It checks that they are stopped and kills them if they cannot be stopped and then starts them. If there are any errors, an email is sent and the user is informed about the progress in the tray-bar. All this is configurable in an Xml-file. It's a small script and should only be used as an example of how the PowerShell can be useful for the daily business (please understand that I don't publish the final version):
- stopping and starting services remotely
- killing a process remotely
- getting ProcessId from service-name
- sending a mail
- executing WMI queries on remote machines
- pinging machines
- Info-bubble in the tray bar
- creating and writing into EventLogs
- handling exceptions
- working with Xml-files
- passing parameter to a function
- working with ref-variables
Update: (09/07/11) Updated script with some fixes and changes in the behavior.
Update: (10/07/11) As this was my first experience with PowerShell scripting, I rewrote the script with all what I learned during these days. The script does now restart remotely in a controlled way the services and tracks all info about the executed activities and anomalies during this process.
Update: (23/07/11) Still novice with PowerShell... :-( Refactored the code so that it is now using the pipeline instead of referenced arguments.
Hi Florian.
ReplyDeleteGreat script, I've put it into production and am using it to restart aos-services each night.
Is it possible to use the script to only stop the aos-services as well? To save som time on stopping 16-aos-services accross 4 servers.
Trond
hey florian
ReplyDeletethe download link is not available. can you repost it please /
Thanks
Hello, should work now. It's like all other ressources published on SkyDrive.
ReplyDeleteGreat and that i have a super give: How Much Budget For House Renovation house renovation spreadsheet
ReplyDelete