Update setupScriptLabo.ps1
This commit is contained in:
@@ -98,9 +98,24 @@ if ($UserSID -ne $null -and $UserHKUPath -ne $null) {
|
|||||||
$DisallowRunKeyPath = "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun"
|
$DisallowRunKeyPath = "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun"
|
||||||
if (Test-Path -Path $DisallowRunKeyPath) {
|
if (Test-Path -Path $DisallowRunKeyPath) {
|
||||||
Set-ItemProperty -Path "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "DisallowRun" -Value 1
|
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
|
if ($DisallowRunKeyPath.PSObject.Properties.Name -contains "1") {
|
||||||
New-ItemProperty -Path $DisallowRunKeyPath -Name "2" -Value "powershell.exe" -PropertyType String
|
Set-ItemProperty -Path $DisallowRunKeyPath -Name "1" -Value "cmd.exe" -PropertyType String
|
||||||
New-ItemProperty -Path $DisallowRunKeyPath -Name "3" -Value "powershell_ise.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 {
|
} else {
|
||||||
New-Item -Path $DisallowRunKeyPath -Force
|
New-Item -Path $DisallowRunKeyPath -Force
|
||||||
Set-ItemProperty -Path "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "DisallowRun" -Value 1
|
Set-ItemProperty -Path "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "DisallowRun" -Value 1
|
||||||
|
|||||||
Reference in New Issue
Block a user