title: PowerShell convert Char Array to string
body: <p>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:</p>
  
  <pre><code>$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
  </code></pre>
  
  <p>The resulting WPageText is an Char Array so I can't use Select-String -Pattern "days" -Context</p>
  
  <p>I've tried:</p>
  
  <pre><code>$WPageText -join
  [string]::Join("", ($WPageText))
  </code></pre>
  
  <p>as per
  <a href="http://softwaresalariman.blogspot.com.au/2007/12/powershell-string-and-char-sort-and.html" rel="noreferrer">http://softwaresalariman.blogspot.com.au/2007/12/powershell-string-and-char-sort-and.html</a></p>
  
  <p>The only things I have been successful with so far is:</p>
  
  <pre><code>$TempFile = New-Item -ItemType File -Path $env:Temp -Name $(Get-Random)
  $WPageText | Out-File -Path $TempFile
  $String = Get-Content -Path $TempFile
  </code></pre>
  
  <p>Any way to do this aside from writing and reading a file?</p>