Link to home
Start Free TrialLog in
Avatar of cwstad2
cwstad2Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Powershell script to list installed software on multiple machines.

Hi Guys, im looking to develop the script below further by scanning multiple machines to get the results of installed software. when i run the script it seems to ignore the computers txt files and loops around the same machine. also id like to display the machine name which it has come from.

thanks


$computerfile = get-content "C:\Users\Downloads\computers.txt"
ForEach ($computer in $computerfile) {
Get-WmiObject win32_Product  | Select Name,Version,PackageName,Installdate,Vendor | Sort InstallDate -Descending
}
ASKER CERTIFIED SOLUTION
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cwstad2

ASKER

hi i have tried that and get lots of errors. any ideas? also it doesnt dispaly the computer name

Get-WmiObject : Invalid class
At C:\Users\Downloads\Untitled4.ps1:4 char:14
+ Get-WmiObject <<<<  win32_Product  -computer $computer | Select Name,Version,PackageName,Installdate,Vendor | Sort InstallDate -Descending
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], ManagementException
    + FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
Avatar of cwstad2

ASKER

is there a way to display in the output the machine name?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cwstad2

ASKER

thanks
Can you please share how to save all those machines output in single file?

Currently it is displaying output in the screen. I wanted to save all the files output in single file.