Solved

Powershell script to list installed software on multiple machines.

Posted on 2013-05-10
6
2,564 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 81

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 81

Expert Comment

by:David Johnson, CD, MVP
ID: 39156440
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
The viewer will learn how to count occurrences of each item in an array.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

707 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