「Shell.Application」の活用(1)

「Shell.Application」はWindowsのシェル機能を利用できるCOMオブジェクトです。

URLに任意文字列を含むIEを終了させる
(Quit the IE with URL that contains specified string)

URLに「google」を含むIEを終了する
function quitIE()
{
    PARAM([String]$urlKeyword)
    $app = new-object -com Shell.Application
    $app.Windows() | where{$_.Document.URL -match $urlKeyword} | foreach{$_.quit()}
}
quitIE "google"