Home > Powershell Script > Powershell: Check if IIS is Running on a Remote Server

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
  1. Evan
    September 27, 2011 at 2:35 pm | #1

    Awesome! Very handy

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.