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"}
}

11 thoughts on “Powershell: Check if IIS is Running on a Remote Server”

    1. You can get the IIS version from the registry: HKLM:\SOFTWARE\Microsoft\InetStp\VersionString. From powershell: get-itemproperty HKLM:\SOFTWARE\Microsoft\InetStp\ | Select VersionString

  1. Hello Brian,
    This script works like a gem.
    Wondering if we can add a script to this to also list the application pools by and their status on remote servers ?

    Thank you

  2. Your script might not work well on server 2012 IIS machines. I changed it to key off the service “name=’W3SVC'”

Leave a comment