I have created a script that pulls all of the installed software from the domain connected computers. The problem is no matter what I do with format-table and select-object, it never seems to display the computer name, which I need to figure out what computer has what. The command takes an input of computers from Get-ADComputer script and runs the command for each name in the list.
I have tried properties like computername, systemname, pscomputername, and ADcomputer
Get-Content -Path \\server\C$\folder\Computers.txt | ForEach-Object {Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*} | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate, SystemName | format-table SystemName, DisplayName, DisplayVersion, InstallDate -auto | Format-List -Property * | Out-File -FilePath \\server\C$\Folder\Computers11.txt
Each time it shows the computername blank
ForEach-Object
scriptblock, build a PSCustomObject that has what you want in it. that way you can skip theSelect-Object
, and the remarkably silly & destructiveFormat-*
cmdlets. – Lee_Dailey