Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save opexxx/db6c62eba818a1bba163 to your computer and use it in GitHub Desktop.
Save opexxx/db6c62eba818a1bba163 to your computer and use it in GitHub Desktop.
$servers = Get-Content C:\servers.txt
foreach($server in $servers)
{
if( Get-Service -ComputerName $server -Name "Sophos Message Router" -ErrorAction SilentlyContinue)
{
sc.exe \\$server stop "Sophos Message Router" | Out-Null
sleep 5
sc.exe \\$server start "Sophos Message Router" | Out-Null
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment