{{ ansible_password | b64encode | b64decode }}
true
{{ ansible_password | b64encode | b64decode }}
true
{{ item.user_name | default('vagrant') }} User
{{ item.user_name | default('vagrant') }}
Administrators
{{ item.user_name | default('vagrant') }}
true
true
Home
1
{% if not '2008' in (windows_distro_name | default(item.template)) %}
true
true
true
{% endif %}
true
true
{{ ansible_password | b64encode | b64decode }}
true
{{ item.user_name | default('vagrant') }}
true
cmd.exe /c powershell -Command "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force"
Set Execution Policy 64 Bit
1
true
{% if not '2008' in (windows_distro_name | default(item.template)) %}
cmd.exe /c powershell -Command "Set-NetConnectionProfile -NetworkCategory Private"
Set network connection profile to private
2
true
cmd.exe /c winrm quickconfig -q
winrm quickconfig -q
4
true
cmd.exe /c winrm quickconfig -transport:http
winrm quickconfig -transport:http
5
true
cmd.exe /c winrm set winrm/config @{MaxTimeoutms="1800000"}
Win RM MaxTimoutms
6
true
cmd.exe /c winrm set winrm/config/winrs @{MaxMemoryPerShellMB="800"}
Win RM MaxMemoryPerShellMB
7
true
cmd.exe /c winrm set winrm/config/service @{AllowUnencrypted="true"}
Win RM AllowUnencrypted
8
true
cmd.exe /c winrm set winrm/config/service/auth @{Basic="true"}
Win RM auth Basic
9
true
cmd.exe /c winrm set winrm/config/client/auth @{Basic="true"}
Win RM client auth Basic
10
true
cmd.exe /c winrm set winrm/config/listener?Address=*+Transport=HTTP @{Port="5985"}
Win RM listener Address/Port
11
true
cmd.exe /c netsh firewall add portopening TCP 5985 "Port 5985"
Win RM port open
12
true
cmd.exe /c net stop winrm
Stop Win RM Service
13
true
cmd.exe /c sc config winrm start= auto
Win RM Autostart
14
true
cmd.exe /c net start winrm
Start Win RM Service
15
true
{% else %}
cmd.exe /c reg add "HKLM\System\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
Network prompt
2
true
cmd.exe /c powershell -Command "{{ set_network_to_private }}"
Set network connection profile to private
3
true
{% endif %}
cmd.exe /c powershell -Command "& $([scriptblock]::Create((New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1'))) -ForceNewSSLCert -EnableCredSSP"
Enable winrm
20
true
cmd.exe /c powershell -Command "Enable-WSManCredSSP -Role Server -Force"
Enable winrm server role
21
true
cmd.exe /c powershell -Command "Set-Item -Path 'WSMan:\localhost\Service\Auth\CredSSP' -Value $true"
Enable credssp authentication
22
true
cmd.exe /c powershell -Command "Resize-Partition -DriveLetter C -Size (Get-PartitionSupportedSize -DriveLetter C).Sizemax -ErrorAction SilentlyContinue"
Extend OS disk
23
true
{% if item.networks is defined and item.networks[0].ip is defined and item.networks[0].gateway is defined and item.networks[0].netmask is defined %}
{% if not '2008' in (windows_distro_name | default(item.template)) %}
cmd.exe /c powershell -Command "New-NetIPAddress –IPAddress {{ item.networks[0].ip }} -DefaultGateway {{ item.networks[0].gateway }} -PrefixLength {{ (item.networks[0].ip + '/' + item.networks[0].netmask) | ipaddr('prefix') }} -InterfaceIndex (Get-NetAdapter | Where-Object { ($_.Name -like '*Ethernet*') -and ($_.Status -like 'Up') })[0].InterfaceIndex"
Set static ip
50
true
{% else %}
cmd.exe /c netsh int ipv4 set address "Local Area connection" static {{ item.networks[0].ip }} {{ item.networks[0].netmask }} {{ item.networks[0].gateway }}
Set static ip
50
true
{% endif %}
{% if item.networks[0].dns_servers is defined %}
{% if not '2008' in (windows_distro_name | default(item.template)) %}
cmd.exe /c powershell -Command "Set-DNSClientServerAddress –InterfaceIndex (Get-NetAdapter | Where-Object { ($_.Name -like '*Ethernet*') -and ($_.Status -like 'Up') })[0].InterfaceIndex –ServerAddresses {{ item.networks[0].dns_servers|join(',') }}"
Set static ip
51
true
{% else %}
cmd.exe /c netsh int ipv4 set dns "Local Area connection" static {{ item.networks[0].dns_servers[0] }}
Set static ip
51
true
{% endif %}
{% endif %}
{% endif %}
false
false
{{ item.name }}
Central Standard Time
true
true