Powershell:如何通过iexplore.exe URL

时间:2016-03-11 08:06:58

标签: internet-explorer powershell url memory

对于每个Iexplore.exe进程,我需要使用powershell检索以下内容;

URL                            Memory Usage(K)
http://www.google.com          80796
http://www.yahoo.com           34748

我每个Iexplore.exe进程只打开1个URL(没有选项卡)。

get-process iexplore让我对每个进程ID的内存使用情况有了很好的了解。 例如;

PS> get-process iexplore

Handles  NPM(K)    PM(K)      WS(K) VM(M)   CPU(s)     Id ProcessName
-------  ------    -----      ----- -----   ------     -- -----------
    870      87    80796      15900   429    27.10   1720 iexplore
    850      82    34748      28548 -1781    23.04   3640 iexplore

此代码段为我提供了打开的网址

PS> $urls = (New-Object -ComObject Shell.Application).Windows()
PS> $urls | where-object { $_.name -eq "Internet Explorer"} | ForEach-Object {$_.LocationUrl, $_.name} 

https://some url .com
Internet Explorer
https://some url .com
Internet Explorer

但是,如果可能的话,我不知道如何结合这些概念。 或者,任何可以提供所需输出的东西就足够了。

原因:

我们在IE浏览器中运行多个业务对象仪表板作为.SWF文件,以及一些其他基于网页的仪表板。然后,他们运行的服务器的视频输出连接到各种大格式1920x1080显示器。

随着时间的推移,IE中会出现内存泄漏。

这将允许我们监视/记录每个Iexplore.exe进程随时间的内存使用情况,并知道该进程正在访问哪个URL。

非常感谢提前。

很抱歉,如果这篇文章的格式很糟糕。这是我的第一次!

1 个答案:

答案 0 :(得分:0)

您可以使用MainWindowHandle

确定流程
$ieInstances = (New-Object -ComObject Shell.Application).Windows()  | where-object { $_.name -eq "Internet Explorer"}
$ieInstances | select LocationUrl, @{e={(Get-Process -Name iexplore| Where-Object MainWindowHandle -eq $_.HWND | select -expand PM)}; l="Memory Usage(K)"}