Skip to content

Instantly share code, notes, and snippets.

@asvignesh
Created April 20, 2019 10:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asvignesh/ae5a1ad1cf036f2481ef26f67816242d to your computer and use it in GitHub Desktop.
Save asvignesh/ae5a1ad1cf036f2481ef26f67816242d to your computer and use it in GitHub Desktop.
Disable UAC on Windows using powershell
$nodes = @("nim-win1-4.asvigneshad.local","nim-win2-5.asvigneshad.local","nim-win3-3.asvigneshad.local","nim-win4-1.asvigneshad.local","nim-win5-5.asvigneshad.local")
$username = "asvigneshad\administrator"
$password = "Password"
$secstr = New-Object -TypeName System.Security.SecureString
$password.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)}
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $secstr
For ($i=0; $i -lt $nodes.Length; $i++) {
$sess = New-PSSession -Credential $cred -ComputerName $nodes[$i]
Enter-PSSession $sess
Set-Itemproperty -path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\policies\system' -Name 'EnableLUA' -value 0
Exit-PSSession
Remove-PSSession $sess
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment