通过PowerShell检查页面重定向

时间:2012-03-12 06:55:19

标签: powershell rds

我正在研究RDWeb访问解决方案,并希望在Internet Explorer页面中键入时将RDS主机重定向到https://rds.ca.org/rdweb

例如,如果我在IE页面中输入srdshost01020304,我想通过PowerShell脚本进行检查,它应该为我提供重定向的链接

1 个答案:

答案 0 :(得分:3)

您可以使用备用主机名向网址发布HttpWebRequest,并检查是否已从重定向的网址发送响应:

$response = [System.Net.WebRequest]::Create("http://srdshost01").GetResponse()
$isRedirected = $response.ResponseUri -eq "https://rds.ca.org/rdweb"