Solved

Powershell script to list installed software on multiple machines.

Posted on 2013-05-10
6
2,043 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
  • 3
  • 2
6 Comments
 
LVL 78

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 78

Expert Comment

by:David Johnson, CD, MVP
ID: 39156440
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 15

Author Comment

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

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
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…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now