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