如何添加PSComputerName
之类的计算机名列?
Invoke-Command -ComputerName $cpu {
Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* |
Where-Object {$_.DisplayName -like "app"} |
Select-Object PSComputerName, DisplayName, DisplayVersion, Publisher, InstallDate |
Format-Table PSComputerName, DisplayName, DisplayVersion, Publisher, InstallDate
} -ErrorAction SilentlyContinue | Out-File $logFile
答案 0 :(得分:1)
您正在阅读的注册表项没有值PSComputerName
。您可以使用calculated property添加它:
Select-Object @{n='PSComputerName';e={$env:COMPUTERNAME}}, DisplayName, ...