Having many Servers running in an IIS Server Farm can sometimes make it difficult to troubleshoot issues.
Using this PowerShell script will help you to find out if the website is returning a value or if it is returning nothing at all.
(For testing through the network) In this code, we first connect to the webserver itself, http://web-01, then we get the Host = "yourwebsite.com" (Change this to your website name in IIS)
[PowerShell - Check if website is Live]
CFFCS |
|
PS (PowerShell)
Expand
Copy
Download Code
try {
Invoke-WebRequest -Uri "http://web-01" -Headers @{ Host = "yourwebsite.com" } -UseBasicParsing
} catch {
$ResponseStream = $ .Exception .Response
Write-Host "Raw Status Description: " $ResponseStream .StatusDescription -ForegroundColor Red
Write-Host "Headers returned from Server:" -ForegroundColor Yellow
$ResponseStream .Headers | Format -List
}
If there is no value, it will display this.
[PowerShell - Invoke-WebRequest Headers (No-Response)]
CFFCS |
|
PS (PowerShell)
Expand
Copy
Download Code
Raw Status Description : Service Unavailable
Headers returned from Server :
Connection
Content -Length
Content -Type
Date
Server
If the webpage does have a response, it will return something like this.
[PowerShell - Invoke-WebRequest Headers (Response)]
CFFCS |
|
PS (PowerShell)
Expand
Copy
Download Code
StatusCode : 200
StatusDescription : OK
Content :
<DOCTYPE html >
<html lang ="en" >
<head >
<meta charset ="utf-8" >
<meta http -equiv ="X-UA-Compatible" content ="IE=edge" >
<meta nam ...
RawContent : HTTP /1.1 200 OK
Access -Control -Allow -Origin : *
X -Frame -Options : sameorigin
Cache -Control : private
Content -Type : text /html
Set-Cookie : ASPSESSIONIDQSTCBABQ =LBFHJGLCKJBDABLNIIJGNMHJ ; path =/
Server ...
Forms :
Headers : {[Access -Control -Allow -Origin , *], [X -Frame -Options , sameorigin ], [Cache -Control , private ], [Content -Type , text /html ]...}
Images : {}
InputFields : {}
Links : {@{outerHTML =<a class ="nav-link" href ="https://cffcs.com/Main/Welcome" title ="Welcome to CFF Coding Source" >Home a >}
ParsedHtml :
RawContentLength : 25331
(For testing on the machine itself) The example.com will be your actual website.com
[PowerShell - Check if website is reachable]
CFFCS |
|
PS (PowerShell)
Expand
Copy
Download Code
Invoke-WebRequest -Uri "http://192.168.3.2/info.asp" -Headers @{"Host" ="example.com" } -UseBasicParsing
info.asp is a script that returns the ServerName on which it is run. This is used in your IIS [
Server Farm ] - [
Health Test ]
[IIS Server Farm - Health Test | Info.asp | Info.aspx]
[ASP Classic | VBScript - Server Up! Script]
Expand
Copy
Download Code
<%Set objWSHNetwork = Server.CreateObject ("WScript.Network" )%>
Server <%=objWSHNetwork.ComputerName%> Up!
[ASP.NET | VBScript - Server Up! Script]
CFFCS |
|
ASP.NET (VB/C#)
Expand
Copy
Download Code
<%@ Page Language="VB" %>
<script runat="server">
Protected Function GetServerName() As String
Return Server.MachineName
End Function
</script>
Server <%= GetServerName() %> Up!
[ASP.NET | C# - Server Up! Script]
CFFCS |
|
ASP.NET (VB/C#)
Expand
Copy
Download Code
<%@ Page Language="C#" %>
<script runat="server">
protected string GetServerName()
{
return Server.MachineName ;
}
</script>
Server <%= GetServerName() %> Up!
[PowerShell - ]
CFFCS |
|
PS (PowerShell)
Expand
Copy
Download Code
Invoke-WebRequest -Uri "http://localhost/info.asp" -UseBasicParsing
Invoke-WebRequest -Uri "http://example/info.asp" -UseBasicParsing
The output from both of the above will look something similar to this.
[PowerShell - Output]
CFFCS |
|
CMD (Windows Command Prompt) | L (Linux)
Expand
Copy
Download Code
StatusCode : 200
StatusDescription : OK
Content :
Server Core-02 Up!With domain: cffcs.com
RawContent : HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
X-Frame-Options: sameorigin
Content-Length: 51
Cache-Control: private
Content-Type : text/html
Date : Thu, 16 Apr 2026 19:52:24 GMT
Set -Cookie: ASPS...
Forms :
Headers : {[Access-Control-Allow-Origin, *], [X-Frame-Options, sameorigin], [Content-Length, 51],
[Cache-Control, private]...}
Images : {}
InputFields : {}
Links : {}
ParsedHtml :
RawContentLength : 51
You can even test out your URL Rewrite with this command as well.
[PowerShell - Check URL Rewrite with this command]
CFFCS |
|
PS (PowerShell)
Expand
Copy
Download Code
Invoke-WebRequest -Uri "http://example/Main/Welcome" -UseBasicParsing
The output will start off the same as above, but will include the HTML header of your page