Tuesday, March 8, 2011

PowerShell | How to know if an Application is installed?

Let's find out if Microsoft Word is installed on the system:

if ((dir REGISTRY::HKEY_CLASSES_ROOT\Word.Application) -ne $Null)
#do word installed stuff such as
$myWord = New-Object -Com Word.Application
$myWord.Visible = $true

Another option would be to catch the exception launched from the failed new-object

Thanks to

No comments:

Post a Comment