Finding Out Whether A Web Page Is Open

by Apr 6, 2009

The Shell.Application COM object returns a list of all open windows, including all opened IE browser windows. This way, you can find out whether a certain URL is visible in any browser window or not.

Check-BrowserURL accepts any URL (or part of it) and returns the number of IE browser windows using this URL:

function Check-BrowserURL($url) {
$win = New-Object -comObject Shell.Application
@($win.windows() | ? { $_.locationURL -like "*$url*" }).Count
}

Check-BrowserURL powershell.com
Check-BrowserURL google.com