【发布时间】:2026-02-11 08:40:01
【问题描述】:
我目前正在尝试使用Get-RemoteProgram script 来列出远程计算机上已安装的程序。
我不仅要捕获远程程序列表,还要捕获单个系统的直接版本。
RemoteProgram -ComputerName remotecomputername -Property DisplayVersion,VersionMajor
ProgramName ComputerName DisplayVersion VersionMajor
------------ ------------ -------------- ------------
System Center Endpoint Protection remotecomputername 4.7.214.0 4
Microsoft Visual Studio 2010 Tools for Office Runtime (x64) remotecomputername 10.0.50903 4
Synaptics 指针设备驱动程序 remotecomputername 18.0.7.34 18
但是,当我在多个系统之间循环时,我完全丢失了 DisplayVersion 和 MajorVersion 字段。
Get-Content -Path C:\Temp\computerlist.txt | ForEach-Object -Begin {RemoteProgram} -Process {RemoteProgram -ComputerName $_ -Property DisplayVersion,VersionMajor}
程序名计算机名
------------ ------------
System Center Endpoint Protection 远程计算机
Microsoft Visual J# 2.0 Redistributable Package - SE (x64) remotecomputer
Mozilla Firefox 57.0.2 (x64 en-US) 远程计算机
Mozilla 维护服务远程计算机
【问题讨论】:
-
RemoteProgram不是标准的 PowerShell 命令,因此您必须包含其实现才能获得帮助。 -
您是否尝试将其通过管道发送到
Format-List *?只是好奇你是否以这种方式看到“缺失”的参数。 -
天哪,成功了!谢谢!那么您认为我将其导出为 CSV 字段会显示吗?还没试过。
-
是的,它应该可以工作(没有
Format-List命令);看我的回答。
标签: powershell