tirador Posted February 11, 2016 Posted February 11, 2016 I have created a script that allows me to automatically unlock and login to a VM using VNC Viewer; however, this works only if the target VM is in locked state (Windows splash screen where "Press CTRL+ALT+DELETE to log on" is displayed). My question is how am I going to instruct/code it using autoit to execute the said line of code IF windows is in locked state only? Here's my code: $file = "C:\AutoLog\vmsource.txt" ;VM IDs are listed in this file FileOpen($file, 0) Func AutoLog() For $i = 1 to _FileCountLines($file) $line = FileReadLine($file, $i) Run("C:\vncviewer.exe") ;Execute VNC Viewer WinActivate("VNC Viewer : Connection Details") ;Set Focus to Connection Details WinWaitActive("[CLASS:#32770]") ;Wait for Connection Details window Sleep(1000) Send("{DEL}") Sleep(1000) Send($line);Target VM ID Sleep(1000) Send("{ENTER}") WinActivate($line) ;Set Focus to VM Window WinWaitActive("[CLASS:rfb::win32::DesktopWindowClass]") ;Wait for VM Sleep(1000) Send("{F8}") Sleep(1000) Send("d") ;Press D to send CTRL+ALT+DELETE Sleep(1000) Send("{ENTER}") Sleep(1000) Send("password") Sleep(1000) Send("{Tab}") Sleep(1000) Send("{ENTER}") WinClose("[CLASS:rfb::win32::DesktopWindowClass]") ;Close VM Next FileClose($file) EndFunc
tirador Posted February 17, 2016 Author Posted February 17, 2016 I found a solution for my problem with the help of QUSER command using a batch file, with this, I can now filter which machine is locked where the above autoit script is needed.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now