Get list of software installed from a remote computer WMI and PowerShell

Get list of software installed from a remote computer WMI and PowerShell

Get list of software installed from a remote computer WMI and PowerShell

Ever wanted to Get list of software installed from a remote computer via WMI and PowerShell 

Open PowerShell and run the following command:

Get-WmiObject -Class “Win32_Product” -ComputerName RemoteHost -Credential localhost\LocalUser | Export-CSV (Join-Path $home “SoftwareList.csv”)

Now to understand how this all ties together.

Get-WmiObject  -Class “Win32_Product” is retrieving the Class object of “Win32_Product” which is products that were installed by a Windows installer.

In this example  | Export-CSV (Join-Path $home “SoftwareList.csv”) takes the results from Get-WmiObject -Class “Win32_Product” which was executed remotely via PowerShell to a remote computer or host. Instead of displaying all of the text information on your local screen, that information is being piped into Export-CSV which is then writing the file name SoftwareList.csv which is located in your home folder.

Q: Where is my home folder located?
A: In PowerShell your home folder is in (Drive Letter):\User\Logon Name

The drive letter will be C: (C Drive), however this won’t be the case if you rearrange where user profiles are being stored.

Microsoft made some PowerShell somewhat similar to some Linux commands so an easy way to change into your home folder is to run the command:
cd ~

The ~ key (pronounced tilde) in the U.S. keyboard layout is left of the number 1 key. Hold shift when pressing the ` key next to the 1 and it will display the ~ character.

Another method is to run:
cd $home

both commands will accomplish the same goal in changing into your home folder.

Below is Microsoft documentation for the following:
WMI Classes > Win32 Classes > Installed Application Classes > Win32_Product Class

Posted in Hyper-V, Hyper-V 2012 R2, PowerShell, Scripting, Tutorials, Windows, Windows 7, Windows 8, Windows Server, Windows Server 2012 R2 and tagged , .

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *