PowerShell

PowerShell: How to get a list of all installed Software on Remote Computers

WMI is a powerful feature. Remember that WMI is CMI and CMI is WMI. In this blog post I am going to play with WMI Objects on the local computer and on remote computers. If you want to do an inventory of all installed software in your active directory domain, then keep on reading my post.

Get-WmiObject vs. Get-CimInstance

WMI and CIM is a definition of management information. Vendors use WMI to provide their informations. In this article we will concentrate on the class win32_product. The win32_product class provides information of all installed software. But there are differences between Get-WmiObject and Get-CimInstance.

The output


Get-WmiObject win32_product

Unbenannt.PNG


Get-CimInstance win32_product

Unbenannt.PNG

The output is different. But it’s not the only variation.

Browsing classes

Get-CimInstance enables you to browse all possible classes by pressing TAB or to type win32_ and press CTRL + Space. You get warned: “Are you sure you want to show all of them?” 😉 Yes, you are.

Unbenannt.PNG

I think it’s better to proceed with Get-CimInstance.

Getting all installed software on the local host

As promised, we concentrate on gathering information of installed software. To do so, I recommend modifying the output. What are the most important informations and how to get them? Simply run Get-Member to explore all properties.

Unbenannt.PNG

I’ve highlighted some of them which are in my view the most important ones. To get a better screen I send the output to Out-GridView.


Get-CimInstance win32_product | Select-Object Name, PackageName, InstallDate | Out-GridView

Unbenannt1.PNG

Nice. So we have a list of our currently installed software. Let’s go to the bigger challenge: To retrieve a list of software from remote computers.

Get installed Software from Remote Computers

Make sure WinRM is enabled on your computers. WinRM is enabled by default on Windows Server 2012/2016, but not on Client operating systems. More about enabling WinRM in this article:

Group Policies: Enabling WinRM for Windows Client Operating Systems (Windows 10, Windows 8, Windows 7)

Ok, my testing environment is very small. I only have 2 computers (server02 and client01). Let’s get the Computer Names from Active Directory from a specific OU and then run Get-CimInstance against them.


(Get-ADComputer -Filter * -Searchbase "OU=Test,DC=sid-500,DC=com").Name | Out-File C:\Temp\Computer.txt | notepad C:\Temp\Computer.txt

Unbenannt1.PNG

Review your list carefully. Now we call the shots. Here we go.


Get-CimInstance -ComputerName (Get-Content C:\Temp\Computer.txt) -ClassName win32_product -ErrorAction SilentlyContinue| Select-Object PSComputerName, Name, PackageName, InstallDate | Out-GridView

Unbenannt1.PNG

Have fun documenting your environment!

See also

PowerShell: Getting RAM Info by manufacturer, speed, serial number and capacity

10 replies »

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.