From 64801591067e1d99bd0fd9b63c06b9a77cf37b4c Mon Sep 17 00:00:00 2001 From: Lightemerald Date: Mon, 23 Oct 2023 12:35:45 +0000 Subject: [PATCH] Update setupScriptInfo.ps1 --- setupScriptInfo.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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