File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
enos/modules/aws_windows_client Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -231,14 +231,24 @@ resource "aws_instance" "client" {
231231 New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
232232
233233 # Create a non-admin user to be used for RDP connection. This
234- # is needed since the scheduled task that runs pyautogui
234+ # is needed since the scheduled task that runs desktop automation
235235 # doesn't work in an Administrator context.
236236 ## Create a local user
237237 $Username = "${ local . test_username } "
238238 $Password = ConvertTo-SecureString "${ local . test_password } " -AsPlainText -Force
239239 New-LocalUser $Username -Password $Password -FullName "Auto Login User" -Description "User for Auto Login"
240240 Add-LocalGroupMember -Group "Administrators" -Member $Username
241241
242+ # Disable windows snapping assist. This is done to reduce
243+ # complexity in RDP automated tests since the snapping assist
244+ # window introduces an additional UI element that needs to be handled.
245+ Set-ItemProperty -Path "HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced" -Name "SnapAssist" -Value 0 -Force
246+
247+ $script = 'Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "SnapAssist" -Value 0 -Force; Stop-Process -Name explorer -Force; Start-Process explorer.exe'
248+ $action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NonInteractive -WindowStyle Hidden -Command $script"
249+ $trigger = New-ScheduledTaskTrigger -AtLogOn -User "autologinuser"
250+ Register-ScheduledTask -TaskName "RemoveSnapAssist" -Action $action -Trigger $trigger -User "autologinuser" -RunLevel Highest -Force
251+
242252 # Set registry keys for auto-login
243253 $regPath = "HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon"
244254 Set-ItemProperty -Path $regPath -Name "AutoAdminLogon" -Value "1" -Type String
You can’t perform that action at this time.
0 commit comments