From 3f8ebed960a5ca413b70e5e0e0e8562e3a2a6a65 Mon Sep 17 00:00:00 2001 From: Lightemerald Date: Tue, 10 Oct 2023 08:17:25 +0000 Subject: [PATCH] Update setupScriptLabo.ps1 --- setupScriptLabo.ps1 | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/setupScriptLabo.ps1 b/setupScriptLabo.ps1 index bc28b8f..c3df274 100644 --- a/setupScriptLabo.ps1 +++ b/setupScriptLabo.ps1 @@ -98,9 +98,24 @@ if ($UserSID -ne $null -and $UserHKUPath -ne $null) { $DisallowRunKeyPath = "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun" if (Test-Path -Path $DisallowRunKeyPath) { Set-ItemProperty -Path "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "DisallowRun" -Value 1 - New-ItemProperty -Path $DisallowRunKeyPath -Name "1" -Value "cmd.exe" -PropertyType String - New-ItemProperty -Path $DisallowRunKeyPath -Name "2" -Value "powershell.exe" -PropertyType String - New-ItemProperty -Path $DisallowRunKeyPath -Name "3" -Value "powershell_ise.exe" -PropertyType String + if ($DisallowRunKeyPath.PSObject.Properties.Name -contains "1") { + Set-ItemProperty -Path $DisallowRunKeyPath -Name "1" -Value "cmd.exe" -PropertyType String + } + else { + New-ItemProperty -Path $DisallowRunKeyPath -Name "1" -Value "cmd.exe" + } + if ($DisallowRunKeyPath.PSObject.Properties.Name -contains "2") { + New-ItemProperty -Path $DisallowRunKeyPath -Name "2" -Value "powershell.exe" -PropertyType String + } + else { + New-ItemProperty -Path $DisallowRunKeyPath -Name "2" -Value "powershell.exe" + } + if ($DisallowRunKeyPath.PSObject.Properties.Name -contains "3") { + New-ItemProperty -Path $DisallowRunKeyPath -Name "3" -Value "powershell_ise.exe" -PropertyType String + } + else { + New-ItemProperty -Path $DisallowRunKeyPath -Name "3" -Value "powershell_ise.exe" + } } else { New-Item -Path $DisallowRunKeyPath -Force Set-ItemProperty -Path "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "DisallowRun" -Value 1