PowershellGuru
  • Home
  • Active Directory Scripts
  • Script Repository
  • DHCP Scripts
  • DNS Scripts
  • Blogs
  • Community
  • Login
No Result
View All Result
PowershellGuru
  • Home
  • Active Directory Scripts
  • Script Repository
  • DHCP Scripts
  • DNS Scripts
  • Blogs
  • Community
  • Login
No Result
View All Result
PowershellGuru
No Result
View All Result
Home Powershell Script blogs

Get installed software list quickly using PowerShell (2021)

themeanmachine19@gmail.com by [email protected]
December 23, 2021
in Powershell Script blogs
0
Get installed software list quickly using PowerShell
Share on FacebookShare on Twitter

You might also like

Instant guide to convert ps2 to exe

Instant Guide To Convert PS1 To EXE (2022)

May 21, 2022
PowerShell tips and tricks

5 Useful PowerShell Tips and Tricks

May 15, 2022

Hello, PowerShell enthusiast wishing you all Merry Christmas and a Happy New Year,  today we will understand on creating a PowerShell script to fetch all the installed software details from remote servers. This will be an easy task for us if you are following me through all of my posts.

Don’t get amazed to see a few things which I have used in my old post. As you must be knowing past experience and knowledge is always helpful in your life. So let’s move ahead and dive into our script.

Get installed software list quickly using PowerShell

Script Requirements

Before we proceed further we need to understand some of the points which will help us to understand the script clearly.

  • To understand what exactly is New-Object PSObject go through the link to understand more on this.
  •  
  • We will use Get-WmiObject -ClassName Win32_product to fetch the application details from remote servers.

How to get installed application details using Powershell

As mentioned above we need a class Win32_product which will provide us the list of all the applications installed in your or remote servers. Below is one example and the result.

The output will vary as it depends upon the application installed on your system or the system sitting remotely. If the count of applications is high the command will take time to get executed.

				
					Get-WmiObject -ClassName Win32_product

#####Output##########

IdentifyingNumber : {E503B4BF-F7BB-3D5F-8BC8-F694B1CFF942}
Name              : Microsoft Visual C++ 2008 Redistributable - x86 9.0.21022.218 False
Vendor            : Microsoft Corporation
Version           : 9.0.21022.218
Caption           : Microsoft Visual C++ 2008 Redistributable - x86 9.0.21022.218 False
				
			

#Step 1

This is my vintage style to invoke my foreach loop.

				
					$comp= gc "C:\servers.txt"
$infoObject=@()
$results=@()
foreach($co in $comp)
{
$co
				
			

#Step 2

This step is not at all mandatory but if you want the script output to look great use this. The below line will have a CSS code.

				
					$css = @"
<style>
h1, h5, th { text-align: center; font-family: Segoe UI; }
table { margin: auto; font-family: Segoe UI; box-shadow: 10px 10px 5px #888; border: thin ridge grey; }
th { background: #0046c3; color: #fff; max-width: 400px; padding: 5px 10px; }
td { font-size: 11px; padding: 5px 20px; color: #000; }
tr { background: #b8d1f3; }
tr:nth-child(even) { background: #dae5f4; }
tr:nth-child(odd) { background: #b8d1f3; }
</style>
"@
				
			

#Step 3

As discussed earlier we will use New-object PSObject and we will assign it to $infoObject.

$p is assigned with test-connection which gives a boolean output either true or false.

In any case, if the server is not reachable from the host where we are running the script it will return $false. Hence we will run the required script on the servers which are reachable from our source server.

				
					$infoObject = New-Object PSObject
$p=Test-Connection -ComputerName $co -BufferSize 16  -Count 1 -Quiet 
$p
if ($p -eq $true)
{
				
			

#Step 4

$os will fetch the operating system of the remote server.

 $h will fetch the name of the application installed on remote servers.

$infoObject will be provided with the output of $co, $p, $os and $h.

				
					$os = (Get-WMIObject win32_operatingsystem -ComputerName $co ).caption
$os
$product=Get-WmiObject -ClassName Win32_product -Property *|select Name
$h=($product|select @{Name="name" ;expression={$product.name -join ","}} -Last 1).name
$h
$infoObject|Add-Member -MemberType NoteProperty -Name "Hostname"  -value $co
$infoObject|Add-Member -MemberType NoteProperty -Name "Reachable"  -value $p
$infoObject|Add-Member -MemberType NoteProperty -Name "Operating System"  -value $os
$infoObject|Add-Member -MemberType NoteProperty -Name "Product" -Value $h
$results+=$infoObject
}
				
			

#Step 5

In Else, we will provide blank output so that it will not interfere with our original output.

				
					else
{

$infoObject|Add-Member -MemberType NoteProperty -Name "Hostname"  -value $co
$infoObject|Add-Member -MemberType NoteProperty -Name "Reachable"  -value $p
#$infoObject|Add-Member -MemberType NoteProperty -Name "Operating System"  -value $os
#$infoObject|Add-Member -MemberType NoteProperty -Name "Auto Stopped services" -Value $h
$results+=$infoObject

}
}

				
			

#Step 6

Lastly, export the result in CSV file and using Export-CSV and convert the output of the CSV in HTML format using ConvertTo-HTML.

				
					$results|Export-csv "C:\Users\admin\Desktop\result.csv" -NoTypeInformation 
Import-CSV "C:\Users\admin\Desktop\result.csv" | ConvertTo-Html -Head $css  | Out-File "C:\Users\admin\Desktop\installedapp.html" 
				
			

#Results

Conclusion

I hope you have liked the post Get installed software list quickly using PowerShell and will implement this whenever it is required. Things you should always remember is to try with one more server so that it will be easy for you to make changes. Let me know if you want a blog post on some other script that might amaze you.

We are working continuously to provide you with the better and the best scripts daily. We will publish weekly hence don’t forget to subscribe to our newsletter. 

Please login to join discussion
close

DON’T MISS A POST

Keep up to date with PowershellGuru

Powershell Blogs

PowershellGuru provides the best PowerShell scripts available that can be used and download freely. Do Check our blogs to get updated regularly.

Check your inbox or spam folder to confirm your subscription.

themeanmachine19@gmail.com

[email protected]

Related Stories

Instant guide to convert ps2 to exe

Instant Guide To Convert PS1 To EXE (2022)

by [email protected]
May 21, 2022
0

Instant guide to convert ps1 to exe. How to convert ps1 to exe. PS2exe. Convert ps1 to exe using ps2exe.

PowerShell tips and tricks

5 Useful PowerShell Tips and Tricks

by [email protected]
May 15, 2022
0

Useful Powershell tips and tricks. PowerShell tips and tricks. Know Powershell tips and tricks. get-help. get-alias.

tips to manage hyper-v using powershell

5 Tips To Manage Hyper-V Using PowerShell

by [email protected]
May 1, 2022
0

Tips to manage hyper-v using PowerShell. How to manage Hyper-V using PowerShell. Powershell to manage Hyper-V. Hyper-v and PowerShell.

Mistakes To Avoid While Writing A Powershell Script

5 Big Mistakes To Avoid While Writing A Powershell Script

by [email protected]
April 30, 2022
0

Mistakes to avoid while writing a powershell script. PowerShell mistakes. Avoid these mistakes in a powershell script. PowershellGuru.

Next Post
Detecting Log4j vulnerable servers using PowerShell

Detect Log4j vulnerable servers using PowerShell

Please login to join discussion

Recommended

Get-Eventlog: PowerShell way to query event logs

Get-Eventlog: PowerShell way to query event logs (2022)

March 20, 2022
Pipeline in Powershell

3 Proven ways to Learn Pipeline in Powershell

July 4, 2021

About

Dhrub Bharali

PowerShell Enthusiast

Dhrub is hardcore Powershell enthusiast, he has wriiten more than 100 powershell scripts and he is the sole owner of PowerShellGuru.

Follow Us

Popular Story

  • Installing software remotely using powershell

    Easy way to install software remotely using PowerShell (2021)

    828 shares
    Share 331 Tweet 207
  • Detect Log4j vulnerable servers using PowerShell

    753 shares
    Share 301 Tweet 188
  • How to find NTP Server using PowerShell?

    739 shares
    Share 296 Tweet 185
  • Get-LocalGroupMember: Find Local admin using PowerShell (2021)

    730 shares
    Share 292 Tweet 183
  • Get installed software list quickly using PowerShell (2021)

    696 shares
    Share 278 Tweet 174
  • Home
  • Active Directory Scripts
  • Script Repository
  • DHCP Scripts
  • DNS Scripts
  • Blogs
  • Community
  • Login

© 2022 PowershellGuru- PowerShell Scripts For Automation

No Result
View All Result
  • Home
  • Active Directory Scripts
  • Script Repository
  • DHCP Scripts
  • DNS Scripts
  • Blogs
  • Community
  • Login

© 2022 PowershellGuru- PowerShell Scripts For Automation

This website uses cookies. By continuing to use this website you are giving consent to cookies being used. Visit our Privacy and Cookie Policy.