Skip to content

Instantly share code, notes, and snippets.

@vinyar
Created October 4, 2013 19:20
Show Gist options
  • Save vinyar/5c14cb4899a46caffb0f to your computer and use it in GitHub Desktop.
Save vinyar/5c14cb4899a46caffb0f to your computer and use it in GitHub Desktop.
Windows automation
function Disable-InternetExplorerESC {
$AdminKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}"
$UserKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}"
Set-ItemProperty -Path $AdminKey -Name "IsInstalled" -Value 0
Set-ItemProperty -Path $UserKey -Name "IsInstalled" -Value 0
Stop-Process -Name Explorer
Write-Host "IE Enhanced Security Configuration (ESC) has been disabled." -ForegroundColor Green
}
Disable-InternetExplorerESC
## Disable UAC
function Disable-UserAccessControl {
Set-ItemProperty -Path registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System -Name EnableLUA -Value 0
Write-Host "User Access Control (UAC) has been disabled." -ForegroundColor Green
Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConsentPromptBehaviorAdmin" -Value 00000000
Write-Host "User Access Control (UAC) notification has been disabled." -ForegroundColor Green
}
Disable-UserAccessControl
## powershell environment setup
$b = Split-Path $PROFILE -Parent
New-Item -Type directory $b
'new-alias n "C:\Program Files (x86)\Notepad++\notepad++.exe"' | out-file $profile -append
'new-alias s "C:\Program Files\Sublime Text 2\sublime_text.exe"' | Out-File $PROFILE -Append
'new-alias k knife' | out-file $profile -append
'new-alias chef chef-client' | Out-File $PROFILE -Append
Set-ExecutionPolicy bypass -Scope local -force
## set quick edit mode in CMD
get-ItemProperty -Path HKCU:\Console\%SystemRoot%_System32_cmd.exe -Name QuickEdit -Value 1
## set quick edit mode in Powershell
get-ItemProperty -Path HKCU:\Console\%SystemRoot%_System32_WindowsPowerShell_v1.0_powershell.exe -Name QuickEdit -Value 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment