{"id":4640,"date":"2023-02-16T12:23:33","date_gmt":"2023-02-16T20:23:33","guid":{"rendered":"https:\/\/SUMMALAI.COM\/?p=4640"},"modified":"2023-02-16T12:23:35","modified_gmt":"2023-02-16T20:23:35","slug":"use-powershell-to-find-installed-software-quickly","status":"publish","type":"post","link":"https:\/\/SUMMALAI.COM\/?p=4640","title":{"rendered":"Use PowerShell to Find Installed Software Quickly"},"content":{"rendered":"\n<p>by\u00a0Gayathri R Nayak\u00a0<\/p>\n\n\n\n<p>In certain situations, we may need to check the list of installed software and its version and for this, we can make use of PowerShell.<\/p>\n\n\n\n<p>Here at Bobcares, we have seen several such PowerShell related queries as part of our\u00a0Server Management\u00a0Services for web hosts and online service providers.<\/p>\n\n\n\n<p>Today, we\u2019ll take a look at how to get the list of all installed software using PowerShell.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">PowerShell: Check installed software list locally<\/h2>\n\n\n\n<p>Now let\u2019s see how our\u00a0Support Engineers\u00a0list the installed software locally.<\/p>\n\n\n\n<p>Generally, we make use of Programs and Features in the Control Panel. Or browse all disk partitions in search of a specific app.<\/p>\n\n\n\n<p>Checking the installed software versions by using PowerShell allows gathering data that we need much quicker.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. Get installed software list with Get-WmiObject<\/h3>\n\n\n\n<p>In this method, we simply paste a simple query:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Get-WmiObject -Class Win32_Product<\/code><\/pre>\n\n\n\n<p>Also, we can filter the data to find specific applications from a single vendor, together with their versions, for example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Get-WmiObject -Class Win32_Product | where vendor -eq CodeTwo | select Name, Version<\/code><\/pre>\n\n\n\n<p>This method is quite easy. But it has a downside that it takes quite a while to return the results.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. Query registry for installed software<\/h3>\n\n\n\n<p>Another method is querying the registry to get the list of installed software. Here is a short script that returns the list of applications together with their versions:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$InstalledSoftware = Get-ChildItem \"HKLM:\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\"\nforeach($obj in $InstalledSoftware){write-host $obj.GetValue('DisplayName') -NoNewline; write-host \" - \" -NoNewline; write-host $obj.GetValue('DisplayVersion')}<\/code><\/pre>\n\n\n\n<p>The above command will list all the software installed on the LM \u2013 local machine. However, applications can be installed per user as well. To return a list of applications of the currently logged user, we change HKLM to HKCU (CU stands for \u201ccurrent user\u201d):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$InstalledSoftware = Get-ChildItem \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\"\nforeach($obj in $InstalledSoftware){write-host $obj.GetValue('DisplayName') -NoNewline; write-host \" - \" -NoNewline; write-host $obj.GetValue('DisplayVersion')}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. Getting the list of recently installed software from the Event Log<\/h3>\n\n\n\n<p>To check only the recently installed software, we use the following cmdlet to search through the Event Log.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Get-WinEvent -ProviderName msiinstaller | where id -eq 1033 | select timecreated,message | FL *<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">PowerShell: Get a list of installed software remotely<\/h2>\n\n\n\n<p>It is possible to remotely find the list of installed software on other machines. For that, we need to create a list of all the computer names in the network. Here are the different methods that we can use within a Foreach loop to return results from more than a single remote PC.<\/p>\n\n\n\n<p>$pcname in each script stands for the name of the remote computer on which we want to get a list of installed software and their versions.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. Get installed software list with remote Get-WmiObject command<\/h3>\n\n\n\n<p>The below cmdlet is the easiest one but can take some time to finish:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Get-WmiObject Win32_Product -ComputerName $pcname | select Name,Version<\/code><\/pre>\n\n\n\n<p>where $pcname is the name of the computer we want to query.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. Check installed software with remote registry query<\/h3>\n\n\n\n<p>Remote registry queries are slightly more complicated and require the Remote Registry service to be running. A sample query is as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$list=@()\n$InstalledSoftwareKey=\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Uninstall\"\n$InstalledSoftware=&#91;microsoft.win32.registrykey]::OpenRemoteBaseKey('LocalMachine',$pcname)\n$RegistryKey=$InstalledSoftware.OpenSubKey($InstalledSoftwareKey)\n$SubKeys=$RegistryKey.GetSubKeyNames()\nForeach ($key in $SubKeys){\n$thisKey=$InstalledSoftwareKey+\"\\\\\"+$key\n$thisSubKey=$InstalledSoftware.OpenSubKey($thisKey)\n$obj = New-Object PSObject\n$obj | Add-Member -MemberType NoteProperty -Name \"ComputerName\" -Value $pcname\n$obj | Add-Member -MemberType NoteProperty -Name \"DisplayName\" -Value $($thisSubKey.GetValue(\"DisplayName\"))\n$obj | Add-Member -MemberType NoteProperty -Name \"DisplayVersion\" -Value $($thisSubKey.GetValue(\"DisplayVersion\"))\n$list += $obj\n}\n$list | where { $_.DisplayName } | select ComputerName, DisplayName, DisplayVersion | FT<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. Check recently installed software list from the Event Log remotely<\/h3>\n\n\n\n<p>We can check a user\u2019s event log remotely by adding a single attribute (-ComputerName) to the cmdlet used before:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Get-WinEvent -ComputerName $pcname -ProviderName msiinstaller | where id -eq 1033 | select timecreated,message | FL *<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Check if a GPO-deployed software was applied successfully<\/h2>\n\n\n\n<p>If we apply a certain software version via GPO, then we can easily check if this GPO was successfully applied to a user or not. All we need is the GPResult tool and names of the target computer and user:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gpresult \/s \"PCNAME\" \/USER \"Username\" \/h \"Target location of the\nHTML report\"<\/code><\/pre>\n\n\n\n<p>Finally, we look for the GPO name and check if it is present under Applied GPOs or Denied GPOs.<\/p>\n\n\n\n<p>Ref: <a href=\"https:\/\/bobcares.com\/blog\/powershell-list-installed-software\/\">Use PowerShell to find list of installed software quickly (bobcares.com)<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>by\u00a0Gayathri R Nayak\u00a0 In certain situations, we may need to check the list of installed software and its version and for this, we can make use of PowerShell. Here at Bobcares, we have seen several such PowerShell related queries as part of our\u00a0Server Management\u00a0Services for web hosts and online service providers. Today, we\u2019ll take a <a class=\"read-more\" href=\"https:\/\/SUMMALAI.COM\/?p=4640\">Read More<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[10,1224,14,15],"tags":[1508],"class_list":["post-4640","post","type-post","status-publish","format-standard","hentry","category-microsoft","category-powershell","category-windows-7-8-10","category-windows-servers","tag-find-installed-software-windows"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/4640","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4640"}],"version-history":[{"count":1,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/4640\/revisions"}],"predecessor-version":[{"id":4641,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/4640\/revisions\/4641"}],"wp:attachment":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4640"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4640"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4640"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}