diff --git a/RemoveWindowsAi.ps1 b/RemoveWindowsAi.ps1 index 0d6c80c..b9f7c80 100644 --- a/RemoveWindowsAi.ps1 +++ b/RemoveWindowsAi.ps1 @@ -1636,7 +1636,15 @@ function Hide-AI-Components { } else { if ($existingSettings -and $existingSettings -notlike '*aicomponents;*') { - $newval = $existingSettings + 'aicomponents;' + + if (!($existingSettings.endswith(';'))) { + #doesnt have trailing ; so need to add it + $newval = $existingSettings + ';aicomponents;' + } + else { + $newval = $existingSettings + 'aicomponents;' + } + Reg.exe add 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer' /v 'SettingsPageVisibility' /t REG_SZ /d $newval /f >$null } elseif ($existingSettings -eq $null) {