Get-InstalledSoftware - Get installed software on one or more computers

Returns a list of software program installed on specified computers using the registry.  This avoids the performance impact and potential danger of using the WMI Win32_Product class.

 
 
 
 
 
5 Star
(4)
3,923 times
Add to favorites
Operating System
12/8/2013
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • Can this be used to exclude?
    1 Posts | Last post April 20, 2015
    • I'm interested in finding out, from a list of computers, which machines DO NOT have a particular piece of software installed. Can I use your function to do this?
  • Performance impact and potential danger of using the WMI Win32_Product class
    2 Posts | Last post October 17, 2014
    • What is the potential danger of using the WMI Win32_Product class?
    • Hi Paulo!
      
      Check out the MSDN documentation:
      
      http://msdn.microsoft.com/en-us/library/aa394378(v=vs.85).aspx
      
      "Warning  Win32_Product is not query optimized. Queries such as "select * from Win32_Product where (name like 'Sniffer%')" require WMI to use the MSI provider to enumerate all of the installed products and then parse the full list sequentially to handle the “where” clause. This process also initiates a consistency check of packages installed, verifying and repairing the install. With an account with only user privileges, as the user account may not have access to quite a few locations, may cause delay in application launch and an event 11708 stating an installation failure. For more information, see KB Article 794524."
      
      The key bit:
      
      "This process also initiates a consistency check of packages installed, verifying and repairing the install"
      
      There are a number of other references on the web, but the performance and potential for system changes from a simple 'get' command aren't worth the risk IMHO, particularly when registry based solutions exist.
      
      Would be nice to see an official Cmdlet from Microsoft, but guessing they have other priorities.
      
      Cheers!
  • Add "get product key" in as well?
    1 Posts | Last post July 21, 2014
    • Is there a simple enough way to list product key of any/all software as well?  Just had a request from some techs for doing so with Office 2013, for which the below works, just not sure how to integrate into this awesome script of yours . . .
      
      Try { 
          Switch ((Get-WmiObject Win32_Processor).AddressWidth) { 
                32 {$Path = "hklm:\software\microsoft\office" }
                64 {$Path = "hklm:\software\Wow6432Node\microsoft\office"}
              }
          Get-ChildItem $Path -recurse -ea SilentlyContinue | Where-Object {(Get-ItemProperty -Path $_.PsPath -ea SilentlyContinue) -match "digitalproductid" -eq $True } |  ForEach-Object {$MSRegKey = $_.PsPath}
          $KeyRegValue = (Get-ItemProperty $MSRegKey).digitalproductid[52..66]
          $ProductName = (Get-ItemProperty $MSRegKey).productname
          $ProductId = (Get-ItemProperty $MSRegKey).productid
      
          # decrypt base24 encoded binary data
          $ProductKey = ""
          $chars = "BCDFGHJKMPQRTVWXY2346789"
          for ($i = 24; $i -ge 0; $i--) {
              $k = 0
              for ($j = 14; $j -ge 0; $j--) {
                  $k = ($k * 256) -bxor $KeyRegValue[$j]
                  $KeyRegValue[$j] = [math]::Truncate($k / 24)
                  $k = $k % 24
              }
              $ProductKey = $chars[$k] + $ProductKey
              if (($i % 5) -eq 0 -and $i -ne 0) {
                  $ProductKey = "-" + $ProductKey
              }
          }
          Write-Host  $ProductName
          Write-Host "Product ID is" $ProductId
          Write-Host "Product Key(license key) is"  $ProductKey
          Write-Host  "Script Check passed"
          Exit 0 
      }
      Catch {
          Write-Host  "Script Check Failed"
          Exit 1001 
      }
  • Output empty
    2 Posts | Last post May 23, 2014
    • Hi, 
      When I run the script .\Get-InstalledSoftware there is no output at all. 
      
      I'm new to powershell, so I'm really lost as to why this is happening. Any ideas?
      
      Thanks
      Alexander
    • Hello Alexanred!
      
      The script contains a function.  By running it, the Get-InstalledSoftware command becomes available in your session.  If you step through the code in the post, you should see an example.  Basically:
      
      . "C:\Path\To\Get-InstalledSoftware.ps1" #This loads the function, no output shows up
      Get-InstalledSoftware -ComputerName LocalHost #This runs against your computer and will produce output
      
      Check out the rest of the Description page for more examples and details on getting help for this command.
      
      Hopefully this helps!  Keep learning and exploring PowerShell, it's a great tool to have in your toolbelt!
      
      CM