How can I add some computername column like 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
The registry key you're reading doesn't have a value PSComputerName
. You can add it with a calculated property , though:
Select-Object @{n='PSComputerName';e={$env:COMPUTERNAME}}, DisplayName, ...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.