Skip to content

Instantly share code, notes, and snippets.

@rayterrill
Last active December 13, 2016 18:13
Show Gist options
  • Save rayterrill/b5ecc1d4baa637bf6a01e3ece2e51316 to your computer and use it in GitHub Desktop.
Save rayterrill/b5ecc1d4baa637bf6a01e3ece2e51316 to your computer and use it in GitHub Desktop.
Configure Vagrant Machine
$ProgressPreference='SilentlyContinue'
#Enable Remote DesktopSet-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -Name "fDenyTSConnections" -Value 0
Set-NetFirewallRule -Name RemoteDesktop-UserMode-In-TCP -Enabled True
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name "UserAuthentication" -Value 1
#disable complex passwords
secedit /export /cfg c:\secpol.cfg
(gc C:\secpol.cfg).replace("PasswordComplexity = 1", "PasswordComplexity = 0") | Out-File C:\secpol.cfg
secedit /configure /db c:\windows\security\local.sdb /cfg c:\secpol.cfg /areas SECURITYPOLICY
rm -force c:\secpol.cfg -confirm:$false
#change the password for the Administrator user to vagrant
net user Administrator vagrant
#rename the Administrator account to vagrant
cmd /c 'wmic useraccount where name=''Administrator'' rename vagrant'
#let vagrant autologin
REG ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 1 /f
REG ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d Vagrant /f
REG ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /t REG_SZ /d vagrant /f
#do not launch servermanager at login
REG.exe Add HKCU\Software\Microsoft\ServerManager /V DoNotOpenServerManagerAtLogon /t REG_DWORD /D 0x1 /F
# Disable IE Enhanced Security Configuration for Administrators and Users for web consoles
$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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment