Sign in to follow this  
Followers 0
nameofuser

Local login remotely with AutoIT?

4 posts in this topic

I am trying to log into several computers in a classroom lab all at once. This will save time for the teacher when dealing with younger children.

Basically, I have TightVNCServer running on each machine. I use an AutoIT script (compiled to .exe) to parse a CSV file to get the machine name, username, and password. I then run vncdotool (a python script compiled to .exe) to send keystrokes to the VNC server.

This is my AutoIT script. It works for the most part (a few machines consistently do not respond). I will track down what is up with those later.

#include <Constants.au3>

$AppName = "Lab Login"

$InputFileName =  ($CmdLine[0] = 0) ? StringReplace(@ScriptFullPath, ".exe", ".csv", -1) : $CmdLine[1]

If FileExists($InputFileName) Then
   $hInputFile = FileOpen($InputFileName, $FO_READ)
   If $hInputFile <> -1 Then
      $aLines = FileReadToArray($hInputFile)
      If @error = 0 Then
         For $i = 0 to UBound($aLines) - 1
            $aData = StringSplit($aLines[$i], ",")
            If $aData[0] = 3 Then
               Login($aData[1], $aData[2], $aData[3])
            EndIf
         Next
      Else
         MsgBox($MB_OK, $AppName, "Error reading file: " & $InputFileName)
      EndIf
      FileClose($hInputFile)
   Else
      MsgBox($MB_OK, $AppName, "Error opening file: " & $InputFileName)
   EndIf
Else
   MsgBox($MB_OK, $AppName, "File Not Found: " & $InputFileName)
EndIf

MsgBox($MB_OK, $AppName, "Finished processing (" & $InputFileName & ").")

Func Login ($Machine, $User, $Pass)
   $Dir = @ScriptDir & "\workers"
   $Params = " -p PASSWORD -s " & $Machine & " --delay=1500 key ctrl-alt-del key space type " & $User & " key tab type " & $Pass & " key enter"
   Run($Dir & "\vncdo.exe " & $Params, $Dir, @SW_HIDE)
EndFunc

I found this >post by The Kandie Man in a >thread about VNC and AutoIT (emphasis added):

 

 

I am just curious, why do you want to run the tightVNC viewer in an AutoIt GUI? Is there any particular reason for this? Do you wish to automatically login by using AutoIt? If so, I have written a simple script that does this.

 

 

That is the only thing I could find that doesn't seem to be dealing with having to interact with a VNCViewer window. So, I am wondering if anyone knows where I might find that script or how to accomplish this (remotely initiate a local login OR send just keystrokes to a VNC server - no mouse/screencast required) using only AutoIT. I am trying to make this as close to one-click (or drag-&-drop) for the end user as possible. I plan on throwing in a GUI with progress bar and such, but I want the core functionality rock solid before I bother with that.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You can set the local login for a machine. Google "automatic logon windows 7" and the first hit is a TechNet article that explains it pretty well. Basically, create a locked down user account that can only do so much, then set that account to automatically login when the machine boots up. If the teacher needs to do something else, instruct them on using RunAs.

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Domain policies out of my control prevent this. Auto-logging in for the 2 classes that need it only to have to boot & logout for all the rest would be more of a hassle than it is worth.

Share this post


Link to post
Share on other sites

I've had success sending "stuff" to remote machines using "tcp.au3". Could prove tougher if you have to have to travel over different VLands though (i.e. port openings). 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0