Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Check if IIS running on a remote server

$
0
0
Hi,

I need to check if IIS is running in a remote server. This is what I have collected from web, but not working. Even though IIS is running in the remote-server, but this check always saying "Not running".

---------------------------------

$servers = @("STGNX150-1")

foreach($server in $servers)
{
$iis = get-wmiobject Win32_Service -ComputerName $server -Filter "name='IISADMIN'"
 
if($iis.State -eq "Running")
{Write-Host "IIS is running on $server"}
else
{Write-Host "IIS is not running on $server"}
}

---------------------------------



Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>