From b23204a027f8294141d028f920fa3d2d27e7ad48 Mon Sep 17 00:00:00 2001 From: Enis Kollugil Date: Wed, 10 Oct 2018 12:10:00 +0300 Subject: [PATCH] Add PsVersion Control --- Sherlock.ps1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Sherlock.ps1 b/Sherlock.ps1 index a741b9d..5159810 100644 --- a/Sherlock.ps1 +++ b/Sherlock.ps1 @@ -37,9 +37,13 @@ function Get-FileVersionInfo ($FilePath) { function Get-InstalledSoftware($SoftwareName) { + if ( $(PSVersionTable.PSVersion.Major) -le "2" ) + { + return $false + } + $SoftwareVersion = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -eq $SoftwareName } | Select-Object Version $SoftwareVersion = $SoftwareVersion.Version # I have no idea what I'm doing - return $SoftwareVersion }