title: Check certain text from a webpage via powershell
body: <p>I am trying to get the HTML code from an Intranet webpage and monitor if certain texts or titles exist. This powershell code will be used by my monitoring program to trigger alerts when the webpage is down so that I cannot see that certain texts or titles.</p>
  
  <p>For now, I'm just using Write-Host to see if my piece of code works. I can now extract the HTML source to <code>$output</code>, and I am sure 'Create!' can be found inside. However, I'm not getting a 'YES'.</p>
  
  <p>May I know if <code>$output</code> can be checked by using <code>-contains</code>?</p>
  
  <p>Thank you very much for your help!</p>
  
  <pre><code>$targetUrl  = 'https://myUrl/'
  $ie = New-Object -com InternetExplorer.Application 
  $ie.visible=$true
  $ie.navigate($targetUrl)
  
  while($ie.Busy) {
       Start-Sleep -m 2000
  }
  
  $output = $ie.Document.body.innerHTML
  
  if($output -contains '*Create!*')
  {Write-Host 'YES'}
  else
  {Write-Host 'NO'}
  </code></pre>