获取在Windows上打开的应用程序的列表

我想要一个脚本来做以下事情:

  1. 连接到远程的Windows机器
  2. 获取当前在机器上打开的应用程序的列表,例如我将在任务pipe理器的“应用程序”选项卡中得到的内容,并打印出来。

是否可以批量进行? 如果不是,我还有什么其他的select?

如果你已经安装了powershell,下面的代码会在本地运行时得到一个正在运行的应用程序列表

gps | ? {$_.mainwindowtitle.length -ne 0} | select name, mainwindowtitle 

如果在要查询的计算机上安装了Powershell V2,并且启用了远程处理,则可以运行:

 invoke-command –computername <remote computer name> {gps | ? {$_.mainwindowtitle.length -ne 0} | select name, mainwindowtitle}