Thursday, 6 March 2014

PowerShell Script - Stop similar services

This script can be very important when you want to schedule some of the similar service to stop at certain time for the maintenance purposes. I had one incident in which Altiris asset explorer used to malfunction after a while and solution to the issue is stop its service and restart thus I created the script to get rid of the situation. Here below is the example which I used to stop all SQL services at once.

Change the Bold Part as per your need.

$services = Get-Service
Foreach ($service in $services) {
If($service.name –like ‘SQL*’) {
$service.stop()
}
}

Regards,
Baij

No comments:

Post a Comment

Install Multiple Software with a Click