我正在研究RDWeb访问解决方案,并希望在Internet Explorer页面中键入时将RDS主机重定向到https://rds.ca.org/rdweb
例如,如果我在IE页面中输入srdshost01
或02
或03
或04
,我想通过PowerShell脚本进行检查,它应该为我提供重定向的链接
答案 0 :(得分:3)
您可以使用备用主机名向网址发布HttpWebRequest,并检查是否已从重定向的网址发送响应:
$response = [System.Net.WebRequest]::Create("http://srdshost01").GetResponse()
$isRedirected = $response.ResponseUri -eq "https://rds.ca.org/rdweb"