Home > Enterprise >  How Can I user Powershell to get exe app detail
How Can I user Powershell to get exe app detail

Time:10-05

I am new to Powershell and trying to grab outlook File version details.

get-itemproperty 'C:\program File (x86)\Microsoft Office\office15\outlook.exe' | format-list

That's the command I used, but will pop out Cannot find path error.

outlook.exe Path : C:\program File (x86)\Microsoft Office\office15\outlook.exe

value I need File Version and Product Name value are what I want

CodePudding user response:

The Version of outlook is 16 so the path is not the same... However, the following should dynamically find the install location for you, so it would be irrelevant.

#Set the Reg Key to find
$key = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\OUTLOOK.EXE\'

#Get the Reg Key Property
$outlookExePath = (Get-ItemProperty $key).'(default)'

#Use the Reg Key Property to get the FileInfo 
$OutlookExe = get-item $outlookExePath

#Output the File Info Properties as required    
$OutlookExe.VersionInfo.ProductVersion
$OutlookExe.VersionInfo.ProductName

#Or output selected properties together
$OutlookExe.VersionInfo|Select-Object -Property ProductName,ProductVersion
  • Related