You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 17, 2021. It is now read-only.
Hello @rasta-mouse. I've been trying to adapt Sherlock to work with PowerShell v2 and managed to make it work even with v1 without any problem.
I have an ugly but full functional code here, but I will comment on some suggestions to be adapted accordingly by you in a more beautiful way.
Get-FileVersionInfo():
Instead using Win32_Product class (unstable on v2 and nonexistent on v1), we can use CIM_DataFile.
# Double slash for CIM_DataFile
$FilePath = $FilePath.Replace("\", "\\")
# PsH v1/v2 support via CIM_DataFile
$VersionInfo = (Get-WmiObject -Class CIM_DataFile -Filter "Name='$FilePath'" | Select-Object Version).Version
Also, on WinXP/Win2k3 with v2/v1, for some reason the architecture check fail in some functions and $Path will return null, triggering an error in Get-FileVersionInfo()
I "fixed" it by simply adding an extra Elseif conditional: