top of page

PowerShell - Discover if list of servers/computers is running a particular service

  • Writer: Jon Boyette
    Jon Boyette
  • Jan 10, 2022
  • 1 min read

This prompts for the service name, and checks all in c:\temp\servers.txt if it exists or not and reports to screen,


$servicename = Read-Host "Enter ServiceName to check if exists on list of servers"


$list = get-content “c:\Temp\servers.txt”


foreach ($server in $list) {


if (Get-Service $servicename -computername $server -ErrorAction 'SilentlyContinue'){


Write-Host "$servicename exists on $server "


# do something


}


else{write-host "No service $servicename found on $server."}


}



 
 
 

Recent Posts

See All
PowerShell - List All Domain SPNs

Save as same List_ALL_SPNs.ps1 or similar, this LDap calls the Domain for all Service Principal names and accounts related #Build LDAP...

 
 
 
PowerShell - Start-Monitoring

This is a great script used to Monitor and Email if a server is up or down, once ran, and smtp and from address is set, then run:...

 
 
 

Comments


Post: Blog2 Post
  • Facebook
  • Twitter
  • LinkedIn

©2022 by Boyette Technical Services. Proudly created with Wix.com

bottom of page