From e7b016871d6be97e033872404190292e8010662c Mon Sep 17 00:00:00 2001 From: paradizelost Date: Thu, 29 Mar 2018 17:05:05 -0500 Subject: [PATCH] fix password entry --- Manage-RemoteConnection.ps1 | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Manage-RemoteConnection.ps1 b/Manage-RemoteConnection.ps1 index 091baff..b9136df 100644 --- a/Manage-RemoteConnection.ps1 +++ b/Manage-RemoteConnection.ps1 @@ -51,11 +51,20 @@ function Global:connect-server(){ [void][WinAP]::SetForegroundWindow($process.MainWindowHandle) [void][Winap]::ShowWindow($process.MainWindowHandle, 5) [void][Winap]::ShowWindow($process.MainWindowHandle, 5) - start-sleep 2 + start-sleep 3 #write-output $cred.getnetworkcredential().password - [System.Windows.Forms.SendKeys]::SendWait("$($cred.username){TAB}") - start-sleep .5 - [System.Windows.Forms.SendKeys]::SendWait("$($cred.getnetworkcredential().password){enter}") + foreach ($char in ("$($cred.username)").ToCharArray()) { + [System.Windows.Forms.SendKeys]::SendWait($char) + start-sleep -Milliseconds 30 + } + [System.Windows.Forms.SendKeys]::SendWait("{TAB}") + start-sleep -Milliseconds 30 + foreach ($char in ("$($cred.getnetworkcredential().password)").ToCharArray()) { + [System.Windows.Forms.SendKeys]::SendWait($char) + start-sleep -Milliseconds 30 + } + start-sleep 1 + #[System.Windows.Forms.SendKeys]::SendWait("{enter}") } function Show-Form() { Add-Type -AssemblyName System.Windows.Forms