The code required is fairly straight forward as shown by ChromeSupport.psm1:
class ChromeSupport {
hidden static [string] $Key =
'HKLM:\SOFTWARE\Microsoft\Windows\' +
'CurrentVersion\App Paths\chrome.exe'
static [System.Diagnostics.FileVersionInfo] GetVersionInfo() {
[string] $path =
(Get-ItemProperty ([ChromeSupport]::Key)).'(Default)'
return (Get-Item $path).VersionInfo
}
}
The moduel is invoked from Powershell script, AutomationDriver.ps1:
using module '.\ChromeSupport.psm1'
[ChromeSupport]::GetVersionInfo()
The output from the above script is as follows:
Getting the product version is as matter of invoking the code as follows:
using module '.\ChromeSupport.psm1'
[ChromeSupport]::GetVersionInfo().ProductVersion
The previous code displays:
No comments :
Post a Comment