I've read various methods for converting a char array to a string in PowerShell, but none of them seem to work with my string. The source of my string is:
$ComputerName = "6WMPSN1"
$WarrantyURL = "http://www.dell.com/support/troubleshooting/au/en/aulca1/TroubleShooting/ProductSelected/ServiceTag/$ComputerName"
$WarrantyPage = Invoke-WebRequest -Uri $WarrantyURL
$WPageText = $WarrantyPage.AllElements | Where-Object {$_.id -eq "TopContainer"} | Select-Object outerText
The resulting WPageText is an Char Array so I can't use Select-String -Pattern "days" -Context
I've tried:
$WPageText -join
[string]::Join("", ($WPageText))
as per http://softwaresalariman.blogspot.com.au/2007/12/powershell-string-and-char-sort-and.html
The only things I have been successful with so far is:
$TempFile = New-Item -ItemType File -Path $env:Temp -Name $(Get-Random)
$WPageText | Out-File -Path $TempFile
$String = Get-Content -Path $TempFile
Any way to do this aside from writing and reading a file?