Powershell: Check if IIS is Running on a Remote Server
This is a quick script that will tell you if IIS is running on a list of remote servers. Just like my other scripts this one requires a “servers.txt” file in the same location as the script. I enter all the servers I want to check in that file.
$servers = (Get-Content servers.txt)
foreach($vm in $servers){
$iis = get-wmiobject Win32_Service -ComputerName $vm -Filter "name='IISADMIN'"
if($iis.State -eq "Running")
{Write-Host "IIS is running on $vm"}
else
{Write-Host "IIS is not running on $vm"}
}
Advertisement
Categories: Powershell Script
IIS, IISADMIN, Remote, Running, Server, Service, Started, Win32_Service
Awesome! Very handy