From 7d8c0015e54cb86555fb64b9c6a9e2fde924cc6c Mon Sep 17 00:00:00 2001 From: freedbygrace Date: Thu, 19 Oct 2023 08:33:04 -0400 Subject: [PATCH] Update Invoke-OperatingSystemDiskDetection.ps1 --- Invoke-OperatingSystemDiskDetection.ps1 | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Invoke-OperatingSystemDiskDetection.ps1 b/Invoke-OperatingSystemDiskDetection.ps1 index 75880b6..56651e4 100644 --- a/Invoke-OperatingSystemDiskDetection.ps1 +++ b/Invoke-OperatingSystemDiskDetection.ps1 @@ -320,12 +320,18 @@ Try $TSVariableDictionary.'OSDiskNumber' = $OutputObjectProperties.DesiredOperatingSystemDisk.DiskNumber $TSVariableDictionary.'OSDDiskCount' = $OutputObjectProperties.DiskListCount - ForEach ($TSVariable In $TSVariableDictionary.GetEnumerator()) + Switch ($TSVariableDictionary.Keys.Count -gt 0) { - $LoggingDetails.LogMessage = "$($GetCurrentDateTimeMessageFormat.Invoke()) - Attempting to the value of task sequence variable `"$($TSVariable.Key)`" to `"$($TSVariable.Value)`". Please Wait..." - Write-Verbose -Message ($LoggingDetails.LogMessage) -Verbose + {($_ -eq $True)} + { + ForEach ($TSVariable In $TSVariableDictionary.GetEnumerator()) + { + $LoggingDetails.LogMessage = "$($GetCurrentDateTimeMessageFormat.Invoke()) - Attempting to the value of task sequence variable `"$($TSVariable.Key)`" to `"$($TSVariable.Value)`". Please Wait..." + Write-Verbose -Message ($LoggingDetails.LogMessage) -Verbose - $TSEnvironment.Value($TSVariable.Key) = $TSVariable.Value + $TSEnvironment.Value($TSVariable.Key) = $TSVariable.Value + } + } } } }