Use Powershell to list installed software on remote computers.

Hello,

I am trying to query installed software on a list of workstations and servers using this script but I am getting an error.  May someone take a look at advise what I am missing?

#Software Installed
$computers = get-content "C:\ed\PS\AD\getsoftwareinstalled\computers.txt"
foreach ($computer in $computers) {
write-host "processing computer $computer"
get-wmiobject - class win32_product -computername $computer | select __server, name, version -erroraction slientlycontinue
}

I also would like to export the result to a csv file.  

Please advise.  

Thanks.
nav2567Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

oBdACommented:
The error is the space between the first "-" and "class", and the "slientlycontinue", which should have been silentlycontinue, but makes not much sense in Select-Object.
Try it like this:
#Software Installed
$computers = Get-Content "C:\ed\PS\AD\getsoftwareinstalled\computers.txt"
$computers | ForEach-Object {
	Write-Host "Processing computer $_"
	Get-WmiObject -Class Win32_Product -Computername $_ | Select-Object __server, name, version
} | Export-Csv -NoTypeInformation -Path C:\Temp\Software.csv

Open in new window

1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Hello ThereSystem AdministratorCommented:
We use these two PS commands:
PS: Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize
OR
Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize > C:\InstalledPrograms.txt
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.