-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwin11uac.ps1
More file actions
23 lines (19 loc) · 867 Bytes
/
win11uac.ps1
File metadata and controls
23 lines (19 loc) · 867 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# console execution as administrator : powershell -ExecutionPolicy Bypass -File win11uac.ps1
# reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v PromptOnSecureDesktop /t REG_DWORD /d 0x0 /f
$PromptOnSecureDesktop = (Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System).PromptOnSecureDesktop
if ($PromptOnSecureDesktop -ne 0) {
$registryPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\"
$registryKey = "PromptOnSecureDesktop"
$registryValue = 0
try
{
Set-ItemProperty -Path $registryPath -Name $registryKey -Value $registryValue -ErrorAction Stop
$exitCode = 0
}
catch
{
Write-Error -Message "Could not write regsitry value" -Category OperationStopped
$exitCode = -1
}
}
exit $exitCode