-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathamz.userdata
35 lines (26 loc) · 1.14 KB
/
amz.userdata
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<powershell>
write-output "Running User Data Script"
write-host "(host) Running User Data Script"
# Set TZ
write-output "Setting TZ"
cmd.exe /c tzutil /s \"Pacific Standard Time\"
Set-ExecutionPolicy Unrestricted
# RDP
write-output "Setting up 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"
&winrm quickconfig `-q
&winrm set winrm/config '@{MaxTimeoutms="1800000"}'
&winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="1024"}'
&winrm set winrm/config/client/auth '@{Basic="true"}'
&winrm set winrm/config/service/auth '@{Basic="true"}'
&winrm set winrm/config/client '@{AllowUnencrypted="true"}'
&winrm set winrm/config/service '@{AllowUnencrypted="true"}'
# Firewall
write-output "Setting up Firewall"
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"
write-output "Finished setting up AMI"
</powershell>