From 7d702fda177528bc5dd40c5c0c062ac3160ca2f3 Mon Sep 17 00:00:00 2001 From: Jaap Brasser Date: Thu, 24 Oct 2019 18:23:37 +0900 Subject: [PATCH] Added better string validation --- Get-RemoteProgram/Get-RemoteProgram.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Get-RemoteProgram/Get-RemoteProgram.ps1 b/Get-RemoteProgram/Get-RemoteProgram.ps1 index 51f742d..f072a49 100644 --- a/Get-RemoteProgram/Get-RemoteProgram.ps1 +++ b/Get-RemoteProgram/Get-RemoteProgram.ps1 @@ -228,7 +228,7 @@ Will retrieve list of programs from the local system, while also retrieving Micr } if ($LastAccessTime) { $InstallPath = ($RegBase.OpenSubKey("$CurrentReg$_")).GetValue('InstallLocation') -replace '\\$','' - if ($InstallPath) { + if (-not [string]::IsNullOrEmpty($InstallPath)) { $WmiSplat = @{ ComputerName = $Computer Query = $("ASSOCIATORS OF {Win32_Directory.Name='$InstallPath'} Where ResultClass = CIM_DataFile")