Follow sqlserver-dba.com

Subscribe to RSS feed  Follow @jackvamvas - Twitter

*Use the Comments section for questions

SQLServer-DBA.com Links

Dba_db2_button

dba-ninja.com

SQL Server DBA Jobs

How to get a list of software installed on a server using Powershell

06 May,2014 by Tom Collins

Question: How can I list all software installed on a server using Powershell? I’d also like to compare two servers and report on differences of software installed using Powershell.

Answer:  To list the software installed on server use the Powershell management cmdlet Get-WmiObject -Class Win32_Product

To compare two servers use the output from the Powershell cmdlet Get-WmiObject -Class Win32_Product  and then use the Powershell utility cmdlet  Compare-Object –ReferenceObject to compare the output.

This example illustrates how to create the output

Step 1 :  Create the output for the two servers. Execute this code on the two separate servers. Example 1  outputs to the Powershell GUI. Example 2 , outputs to an output file.

 

--Example 1 – output to GUI
 Get-WmiObject -Class Win32_Product | Select-Object -Property name,installdate | sort-object -property installdate
--Example 2 – output to output file
Get-WmiObject -Class Win32_Product | Select-Object -Property Name > C:\path\server1.txt

 

Step 2 : Using the two output files , execute this Powershell script

 

 Compare-Object -ReferenceObject (Get-Content C:\server1.txt) -DifferenceObject (Get-Content  server2.txt)

 

Example out from the Compare-Object -ReferenceObject

Powershell_compare_object

Read More

SQL Server Database Size and Free Disk Space Daily Report

Powershell Scripts for DBA - SQL Server DBA

Powershell to HTML - SQL Server DBA


Author: Tom Collins (http://www.sqlserver-dba.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on How to get a list of software installed on a server using Powershell


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer