diff --git a/windows/2008r2.json b/windows/2008r2.json index b02c269e4..bab83a945 100644 --- a/windows/2008r2.json +++ b/windows/2008r2.json @@ -48,6 +48,7 @@ "guest_os_type": "windows", "install_command": "powershell.exe -Command \"(new-object Net.WebClient).DownloadString('https://omnitruck.chef.io/install.ps1') | iex; install\"", "run_list": [ + "packer::disable_uac", "packer::cleanup", "packer::defrag" ] diff --git a/windows/2012r2.json b/windows/2012r2.json index ab7336df3..6157fb17a 100644 --- a/windows/2012r2.json +++ b/windows/2012r2.json @@ -29,6 +29,7 @@ "cookbook_paths": ["cookbooks"], "guest_os_type": "windows", "run_list": [ + "packer::disable_uac", "packer::vm_tools", "packer::features", "packer::enable_file_sharing", diff --git a/windows/2016.json b/windows/2016.json index 05da80676..b829dce4d 100644 --- a/windows/2016.json +++ b/windows/2016.json @@ -29,6 +29,7 @@ "cookbook_paths": ["cookbooks"], "guest_os_type": "windows", "run_list": [ + "packer::disable_uac", "packer::vm_tools", "packer::features", "packer::enable_file_sharing", diff --git a/windows/7.json b/windows/7.json index e644328ab..d9f7ee73d 100644 --- a/windows/7.json +++ b/windows/7.json @@ -30,6 +30,7 @@ "guest_os_type": "windows", "install_command": "powershell.exe -Command \"(new-object Net.WebClient).DownloadString('https://omnitruck.chef.io/install.ps1') | iex; install\"", "run_list": [ + "packer::disable_uac", "packer::vm_tools", "packer::features", "packer::enable_file_sharing", diff --git a/windows/cookbooks/packer/recipes/disable_uac.rb b/windows/cookbooks/packer/recipes/disable_uac.rb new file mode 100644 index 000000000..dc80105dd --- /dev/null +++ b/windows/cookbooks/packer/recipes/disable_uac.rb @@ -0,0 +1,6 @@ +registry_key 'HKEY_LOCAL_MACHINE\software\Microsoft\Windows\CurrentVersion\Policies\system' do + values [{ + name: 'EnableLUA', + type: :dword, + data: 0, }] +end diff --git a/windows/cookbooks/packer/recipes/enable_remote_desktop.rb b/windows/cookbooks/packer/recipes/enable_remote_desktop.rb index 38d8cc8ff..92f6db963 100644 --- a/windows/cookbooks/packer/recipes/enable_remote_desktop.rb +++ b/windows/cookbooks/packer/recipes/enable_remote_desktop.rb @@ -1,5 +1,8 @@ -execute 'Enable RDP' do - command 'reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f' +registry_key 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server' do + values [{ + name: 'fDenyTSConnections', + type: :dword, + data: 0, }] end execute 'Enable RDP firewall rule' do