I'm completely new at PS and I'm stuck. I feel like I'm right on the cusp of what I'm trying to do.
Running Windows Server 2008 R2, IIS 7.5 in 32bit mode
Here's my script:
This is the response I'm getting:
My question is: Why does "echo $i" produce the results I want (just /AZ), but when I try to append $i to the end of my website url, it looks like @{path=/AZ}?
How can I get the value of $url to be ?
Running Windows Server 2008 R2, IIS 7.5 in 32bit mode
Here's my script:
Code:
foreach ($i in Get-WebApplication -Site "Default Web Site" | Select-Object -Property Path)
{
echo $i
$url = "[URL unfurl="true"]http://www.mydomain.com/$i"[/URL]
echo $url
$wc = New-Object System.Net.WebClient
$data = $wc.downloadstring($url)
$title = [regex] '(?<=<title>)([\S\s]*?)(?=</title>)'
write-output $title.Match($data).value.trim()
}
This is the response I'm getting:
Code:
IIS7
/AZ
[URL unfurl="true"]http://www.mydomain.com/@{path=/AZ}[/URL]
Exception calling "DownloadString" with "1" argument(s): "The remote server returned an error: (404) Not Found."
At line:7 char:31
+ $data = $wc.downloadstring <<<< ($url)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
My question is: Why does "echo $i" produce the results I want (just /AZ), but when I try to append $i to the end of my website url, it looks like @{path=/AZ}?
How can I get the value of $url to be ?