Created
February 22, 2016 09:45
-
-
Save swade1987/7f05255f3bcbe3925f5b to your computer and use it in GitHub Desktop.
user data file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<powershell> | |
write-output "Starting instance userdata script" | |
write-output "Running User Data Script" | |
write-host "(host) Running User Data Script" | |
cmd.exe /c net user /add vagrant FooBar@123 | |
cmd.exe /c net localgroup administrators vagrant /add | |
Set-ExecutionPolicy -ExecutionPolicy bypass -Force | |
# RDP | |
#cmd.exe /c netsh advfirewall firewall add rule name="Open Port 3389" dir=in action=allow protocol=TCP localport=3389 | |
#cmd.exe /c reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f | |
# WinRM | |
write-output "Setting up WinRM" | |
write-host "(host) setting up WinRM" | |
cmd.exe /c winrm quickconfig -q | |
cmd.exe /c winrm quickconfig '-transport:http' | |
cmd.exe /c winrm set "winrm/config" '@{MaxTimeoutms="1800000"}' | |
cmd.exe /c winrm set "winrm/config/winrs" '@{MaxMemoryPerShellMB="1024"}' | |
cmd.exe /c winrm set "winrm/config/service" '@{AllowUnencrypted="true"}' | |
cmd.exe /c winrm set "winrm/config/client" '@{AllowUnencrypted="true"}' | |
cmd.exe /c winrm set "winrm/config/service/auth" '@{Basic="true"}' | |
cmd.exe /c winrm set "winrm/config/client/auth" '@{Basic="true"}' | |
cmd.exe /c winrm set "winrm/config/service/auth" '@{CredSSP="true"}' | |
cmd.exe /c winrm set "winrm/config/listener?Address=*+Transport=HTTP" '@{Port="5985"}' | |
cmd.exe /c netsh advfirewall firewall set rule group="remote administration" new enable=yes | |
cmd.exe /c netsh firewall add portopening TCP 5985 "Port 5985" | |
cmd.exe /c net stop winrm | |
cmd.exe /c sc config winrm start= auto | |
cmd.exe /c net start winrm | |
</powershell> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment