我想让脚本在下面:
这是我的代码 -
param(
[string[]]$computername='testpc'
)
Get-WmiObject -computername $computername -Class Win32_Product | Select-Object -Property Name, description, installdate, vendor | Sort-Object Name > C:\desktop-apps.txt
答案 0 :(得分:0)
您可以将PSComputerName属性添加到Select-Object和Sort-Object调用:
Get-WmiObject -computername $computername -Class Win32_Product |
Select-Object -Property PSComputerName, Name, description, installdate, vendor |
Sort-Object PSComputerName, Name