Some deployment scripts need to check if certain required software is installed on a Windows Machine. You could check if the file is present at a certain location, but there is a better way: the uninstall database in the Windows Registry. PowerShell makes it really easy to query the registry using Get-ItemProperty. The path you want to query is HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*.

Example: is .Net Core 2.0 Runtime installed?

Let’s check:

The script is both readable and easy to understand.

Need something smaller?

If you really want to hurt yourself need something smaller. Check out this one-liner:

PowerShell for the win!