Solved

Powershell script to list installed software on multiple machines.

Posted on 2013-05-10
6
2,434 Views
Last Modified: 2013-05-15
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
}
0
Comment
Question by:cwstad2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 80

Accepted Solution

by:
David Johnson, CD, MVP earned 250 total points
ID: 39156135
change "Get-WmiObject win32_Product"
to "Get-WmiObject win32_Product   -computer $computer"

you just need to add the -computer parameter
0
 
LVL 15

Author Comment

by:cwstad2
ID: 39156221
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
0
 
LVL 80

Expert Comment

by:David Johnson, CD, MVP
ID: 39156440
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
LVL 15

Author Comment

by:cwstad2
ID: 39156539
is there a way to display in the output the machine name?
0
 
LVL 29

Assisted Solution

by:becraig
becraig earned 250 total points
ID: 39156675
Here is an easy way:

$computerfile = get-content "C:\Users\Downloads\computers.txt"
ForEach ($computer in $computerfile) {
@"
=======================
Displaying for $computer
=======================
"@
Get-WmiObject win32_Product  -computername computer | Select Name,Version,PackageName,Installdate,Vendor | Sort InstallDate -Descending
} 

Open in new window


Also to get wmi working on the remote computers you can simply run a scheduled task on multiple servers to run the following command

enable-psremoting -force
0
 
LVL 15

Author Closing Comment

by:cwstad2
ID: 39168435
thanks
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Synchronize a new Active Directory domain with an existing Office 365 tenant
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question