Update setupScriptInfo.ps1

This commit is contained in:
2023-10-11 10:01:04 +00:00
parent 61d2de8bfc
commit eeb0fe5dba

View File

@@ -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")
Get-ItemProperty -Path $DisallowRunPath | ForEach-Object {
Remove-ItemProperty -Path $DisallowRunPath -Name $_.PSObject.Properties.Name
}
foreach ($valueName in $applications) { foreach ($valueName in $applications) {
$nameExists = $DisallowRunKeyPath.PSObject.Properties.Name -contains $valueName New-ItemProperty -Path $DisallowRunPath -Name $valueName -Value $valueName -PropertyType String
$valueExists = $DisallowRunKeyPath.PSObject.Properties.Value -contains $valueName
if (!$valueExists && !$nameExists) {
New-ItemProperty -Path $DisallowRunKeyPath -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."