Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save opexxx/db6c62eba818a1bba163 to your computer and use it in GitHub Desktop.

Select an option

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