diff --git a/setupScriptInfo.ps1 b/setupScriptInfo.ps1 index 93c0fa3..d6f2719 100644 --- a/setupScriptInfo.ps1 +++ b/setupScriptInfo.ps1 @@ -121,9 +121,11 @@ if ($UserSID -ne $null -and $UserHKUPath -ne $null) { $DisallowRunKeyPath = "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" $DisallowRunValueName = "DisallowRun" SetRegistry -regpath $DisallowRunKeyPath -regproperty $DisallowRunValueName - Write-Host (Get-ItemProperty -Path "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun") $DisallowRunPath = "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun" + if (-not (Test-Path -Path "Registry::$DisallowRunPath" -PathType Container)) { + New-Item -Path "Registry::$DisallowRunPath" -Force + } $applications = @("cmd.exe", "powershell.exe", "powershell_ise.exe") Get-ItemProperty -Path $DisallowRunPath | ForEach-Object { Remove-ItemProperty -Path $DisallowRunPath -Name $_.PSObject.Properties.Name -ErrorAction SilentlyContinue