So this script shows installed applications but it just becomes a jumble of information and doesnt show the computer name (from a list of servers in a text file). Can someone please tell me how to get that to show? This is a powershell script.
That's because of the last line and the Format-Table used there. The Format-* cmdlets are meant to format screen output, not further processing. They should usually be the last element of the pipeline.
The most convenient is usually an export as csv, so that you can easily process it further or view it in Excel or whatever:
I like the CSV output, but it still doesn't show the computer name. I attached the script I ran this time as InstalledAppsNew.txt and the output I received installedapps.csv InstalledAppsNew.txt
oBdA
That is because you changed line 6 from " $computername = $pc" to "$computername = $pc.Computername".
Change that back, or remove the line completely and change the ForEach in line 4 to use $computer instead of $pc:
The most convenient is usually an export as csv, so that you can easily process it further or view it in Excel or whatever:
Open in new window
If you insist on the table view, you'll have to send the output through Out-String before passing it onto the the file:Open in new window