-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenableUAC.ps1
More file actions
16 lines (16 loc) · 886 Bytes
/
enableUAC.ps1
File metadata and controls
16 lines (16 loc) · 886 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$version = (Get-CimInstance Win32_OperatingSystem).Version
$major = $version.split(".")[0]
if ($major -eq 10) {
Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConsentPromptBehaviorAdmin" -Value "2"
} ElseIf ($major -eq 6) {
$minor = $version.split(".")[1]
if ($minor -eq 1 -or $minor -eq 0) {
Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableLUA" -Value "1"
} Else {
Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConsentPromptBehaviorAdmin" -Value "2"
}
} ElseIf ($major -eq 5) {
Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableLUA" -Value "1"
} Else {
Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConsentPromptBehaviorAdmin" -Value "2"
}