Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

disableuac

  • Loading branch information...
commit a5b75417bdadf983f45e145fddfbca4074b868ea 1 parent 990ba05
@ferventcoder authored
View
21 disableuac/disableuac.nuspec
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
+ <metadata>
+ <id>disableuac</id>
+ <title>Disable UAC (User Account Control)</title>
+ <version>0.0.2</version>
+ <authors>Rob Reynolds</authors>
+ <owners>Rob Reynolds</owners>
+ <summary>Disable UAC (User Account Control)</summary>
+ <description>Disable UAC (User Account Control)
+
+This does exactly what it says it does, it disables UAC. Be careful on Windows 8, as the Metro apps will no longer work.
+ </description>
+ <projectUrl>https://github.com/ferventcoder/nugetpackages</projectUrl>
+ <tags>disable uac user account control configuration admin</tags>
+ <releaseNotes></releaseNotes>
+ </metadata>
+ <files>
+ <file src="tools\**" target="tools" />
+ </files>
+</package>
View
34 disableuac/tools/chocolateyInstall.ps1
@@ -0,0 +1,34 @@
+$packageName = 'disableuac'
+
+try {
+ $uacRegPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"
+ $uacRegValue = "EnableLUA"
+ $uacEnabled = $false
+
+ # http://msdn.microsoft.com/en-us/library/windows/desktop/ms724832(v=vs.85).aspx
+ $osVersion = [Environment]::OSVersion.Version
+ if ($osVersion -ge [Version]'6.0')
+ {
+ $uacRegSetting = Get-ItemProperty -Path $uacRegPath
+ try {
+ $uacValue = $uacRegSetting.EnableLUA
+ if ($uacValue -eq 1) {
+ $uacEnabled = $true
+ } else {
+ Write-Host "UAC is already disabled."
+ }
+ } catch {}
+ } else {
+ Write-Host "UAC doesn't exist on this machine."
+ }
+
+ if ($uacEnabled) {
+ Start-ChocolateyProcessAsAdmin "Set-ItemProperty -Path `"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System`" -Name `"EnableLUA`" -Value 0"
+ Write-Host "UAC has been disabled"
+ }
+
+ Write-ChocolateySuccess "$packageName"
+} catch {
+ Write-ChocolateyFailure "$packageName" "$($_.Exception.Message)"
+ throw
+}
Please sign in to comment.
Something went wrong with that request. Please try again.