how to run wmi-object command on a list of PC

Alex Rabbi 66 Reputation points
2022-01-06T11:07:52.217+00:00

Hi All,

I am able to get list of installed apps of remote PC using this command

get-wmiobject Win32_Product -computername TestPC01 | Format-Table IdentifyingNumber, Name, LocalPackage -AutoSize

But i wanted to get same information for several PCs in my company network , can i request your help in how to run the same command with a list of 50 or more hostname.

Thanks
Alex

Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. SChalakov 10,576 Reputation points MVP Volunteer Moderator
    2022-01-06T12:50:49.233+00:00

    Hi Alex,

    please start here, there are soome nice example on how to do Get-WmiObject for remote computers.

    Connecting to WMI Remotely with PowerShell
    https://learn.microsoft.com/en-us/windows/win32/wmisdk/connecting-to-wmi-on-a-remote-computer-by-using-powershell

    This one will also show some hints:

    PowerShell Tip: Querying Multiple Computers with WMI
    https://www.itprotoday.com/powershell/powershell-tip-querying-multiple-computers-wmi

    Here, also some nice examples:

    Get WMI Data From Multiple Computers and Export to CSV
    https://stackoverflow.com/questions/32257328/get-wmi-data-from-multiple-computers-and-export-to-csv

    Hope this helps you out!

    ----------

    If my reply was helpful please don't forget to upvote and/or accept as answer, thank you!
    Regards,
    Stoyan


  2. Rich Matheisen 47,901 Reputation points
    2022-01-06T15:29:06.91+00:00

    Add another property to the Format-Table!

    Gwmi Win32_Product -comp (gc pc.txt) | Format-Table PSComputerName, IdentifyingNumber, Name, LocalPackage -AutoSize
    

    Also, that WMI class doesn't list all installed software. In addition, it performs a repair action on every software is does find (which is why it's slow)!


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.