Hi Folks,
Iām sharing a snippet of code which can help you in restarting some services in multiple remote computers:
$ServiceName = 'Veeam'
$Path = "$([System.Environment]::GetFolderPath("Desktop"))\Servers.txt"
Get-Content -Path $Path | ForEach-Object {
Write-Host "Processing $($_)"
Get-Service -Name "*$($ServiceName)*" -ComputerName $_ |
Where-Object { ($_.Status -eq 'Stopped') -and ($_.StartType -eq 'Automatic') } |
Start-Service -Verbose
}
Hope this can help you in performing the start and stop of the services that you may need.