1
0
mirror of https://github.com/jaapbrasser/SharedScripts.git synced 2025-12-24 21:51:38 +02:00

Added better string validation

This commit is contained in:
Jaap Brasser
2019-10-24 18:23:37 +09:00
parent 3d4425d61c
commit 7d702fda17

View File

@@ -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")