diff --git a/CustomImageTemplateScripts/CustomImageTemplateScripts_2023-05-16/DisableStorageSense.ps1 b/CustomImageTemplateScripts/CustomImageTemplateScripts_2023-05-16/DisableStorageSense.ps1 index 7f3a56f3..91c5434c 100644 --- a/CustomImageTemplateScripts/CustomImageTemplateScripts_2023-05-16/DisableStorageSense.ps1 +++ b/CustomImageTemplateScripts/CustomImageTemplateScripts_2023-05-16/DisableStorageSense.ps1 @@ -6,6 +6,16 @@ # Disable Storage Sense # ####################################### +function Set-RegKey($registryPath, $registryKey, $registryValue) { + try { + Write-Host "*** AVD AIB CUSTOMIZER PHASE *** Disable Storage Sense - Setting $registryKey with value $registryValue ***" + New-ItemProperty -Path $registryPath -Name $registryKey -Value $registryValue -PropertyType DWORD -Force -ErrorAction Stop + } + catch { + Write-Host "*** AVD AIB CUSTOMIZER PHASE *** Disable Storage Sense - Cannot add the registry key $registryKey *** : [$($_.Exception.Message)]" + } + } + $stopwatch = [System.Diagnostics.Stopwatch]::StartNew() Write-Host "***Starting AVD AIB CUSTOMIZER PHASE: Disable Storage Sense Start - $((Get-Date).ToUniversalTime()) " @@ -31,16 +41,8 @@ $elapsedTime = $stopwatch.Elapsed Write-Host "*** AVD AIB CUSTOMIZER PHASE: Disable Storage Sense - Exit Code: $LASTEXITCODE ***" Write-Host "*** Ending AVD AIB CUSTOMIZER PHASE: Disable Storage Sense - Time taken: $elapsedTime " -function Set-RegKey($registryPath, $registryKey, $registryValue) { - try { - Write-Host "*** AVD AIB CUSTOMIZER PHASE *** Disable Storage Sense - Setting $registryKey with value $registryValue ***" - New-ItemProperty -Path $registryPath -Name $registryKey -Value $registryValue -PropertyType DWORD -Force -ErrorAction Stop - } - catch { - Write-Host "*** AVD AIB CUSTOMIZER PHASE *** Disable Storage Sense - Cannot add the registry key $registryKey *** : [$($_.Exception.Message)]" - } - } + ############# # END # -############# \ No newline at end of file +#############