Update setupScriptInfo.ps1
This commit is contained in:
@@ -98,14 +98,14 @@ if ($UserSID -ne $null -and $UserHKUPath -ne $null) {
|
||||
$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"
|
||||
$applications = @("cmd.exe", "powershell.exe", "powershell_ise.exe")
|
||||
Get-ItemProperty -Path $DisallowRunPath | ForEach-Object {
|
||||
Remove-ItemProperty -Path $DisallowRunPath -Name $_.PSObject.Properties.Name
|
||||
}
|
||||
foreach ($valueName in $applications) {
|
||||
$nameExists = $DisallowRunKeyPath.PSObject.Properties.Name -contains $valueName
|
||||
$valueExists = $DisallowRunKeyPath.PSObject.Properties.Value -contains $valueName
|
||||
if (!$valueExists && !$nameExists) {
|
||||
New-ItemProperty -Path $DisallowRunKeyPath -Name $valueName -Value $valueName -PropertyType String
|
||||
}
|
||||
New-ItemProperty -Path $DisallowRunPath -Name $valueName -Value $valueName -PropertyType String
|
||||
}
|
||||
} else {
|
||||
Write-Host "Unable to get the user's HKU registry."
|
||||
|
||||
Reference in New Issue
Block a user