I have a powershell script I created to query services that are running on servers in my environment. As it stands now, the script will work, returning running services then stop. I am trying to figure out a way to have the script go back to the beginning and prompt for the next server name so I can repeatedly execute it
$Server = Read-Host -Prompt 'Enter Server Name'
Get-Service -ComputerName $Server | Where Status -eq "Running"
Out-GridView
Read-host "press enter to continue.."
while ($true) { Read-Host "You'll need Ctrl-C to stop this." }