Jump to content

How to send CTRL+Alt+Del, Login/Password to VNC-Server?


Recommended Posts

Hi.

I thought about an easy way to logon on several Win2k-Clients with the same Admin-Login for mainteance.

So what about this plan:

1.) Start VNC-Service on all Clients via psexec with a batch-Script

2.) Ask for login and password and copy it to the clipboard.

3.) Open VNC-Session to Workstation1 --> send CTRL-ALT-DEL, send login/password from the clipboard afterwards

--> User is logged in without any registry-hacking???!?? Close the VNC-Window and open the next Workstation2, 3, 4, ...16

for this procedure.

4.) Execute/Install any program on all Remote Desktops...

Is it possible to do 2.) and 3.) with a little AutoIt-Script? Did anyone already try this way to logon "automatically"??

Thanks for any suggestions...

Link to comment
Share on other sites

If you are the admin you wouldn't be asking for passwords. UltraVNC can authenticate with AD now instead of using a vnc password so as long as you are the domain admin you dont have to do anything but install it.

Link to comment
Share on other sites

If you are the admin you wouldn't be asking for passwords. UltraVNC can authenticate with AD now instead of using a vnc password so as long as you are the domain admin you dont have to do anything but install it.

Wow! Sounds good! Yes -- I am the admin of that little domain. Is it also possible to login on all machines the "same" time or is it still hard work to click through all the windows?

Link to comment
Share on other sites

No matter how you authenticate vnc you will still see whatever the end user has on the screen. If you are needing to login with admin rights you may just want to use remote desktop if its too painful to logoff each user.

You also may want to look into Sysinternals PSexec to run a script remotely with whatever permissions you specify. I wrote a script a long time ago for pushing programs, spyware scans, etc... which used psexec at the core.

http://www.autoitscript.com/forum/index.ph...mp;hl=archrival

Using this method I could run a script remotely. For example:

$root="\\United\3rdParty\Software\Acrobat Reader\Adobe 7.0.7"
$file = FileExists ( $root & "\setup.exe" )
If $file = 0 Then Exit
DirCreate ( $root & "\Logs" )
$log = FileOpen ( $root & "\Logs\" & @ComputerName & "-" & @YEAR & "-" & @MON &"-" & @MDAY & ".log", 1 )

If FileExists ( @ProgramFilesDir & "\Adobe\Acrobat 7.0\Reader\AcroRd32.exe" ) Then
FileWrite($log, "Package already installed " & @HOUR & ":" & @MIN & @CRLF)
Exit(0)
EndIf

FileWrite($log, "Started  at " & @HOUR & ":" & @MIN & @CRLF)
$run = RunWait ("msiexec.exe /i ""Adobe Reader 7.0.7.msi"" TRANSFORMS=""acrobat7.mst"" /qb- /norestart" , $root & "\")

If $run = 0 Then
FileWrite($log, "Complete at " & @HOUR & ":" & @MIN & @CRLF)
FileClose ( $log )
Exit(0)
Else
FileWrite($log, "Failed at " & @HOUR & ":" & @MIN & @CRLF)
FileClose ( $log )
Exit(1)
EndIf

Even if the end user didn't have permission to that share or even admin permission it doesn't matter because psexec will pass your credentials. Also it doesn't matter if the user is logged in, locked, logged off, it will run as long as there are no window automations involving the mouse or keyboard.

The above script is completely silent so the user sees little or nothing. Basically you compile this script into an exe and use psexec with the flag to copy the file to the destination.

Edited by weaponx
Link to comment
Share on other sites

Yes, that is what I was searching for.

The first problem to solve was the auotmated logon. The way with UltraVNC or VNCon is much more elegant and easy.

The next step will surely be an automated installation of some packages or whatever. At the moment we deal with "setacl", "psexec" and "xcopy" to set permissions or copy some small files to all Workstations. This works fine so far but it's surely not enough.

I don't know if you know the program "HD Guard"? We have a PC-Pool with "protected" PCs. With this program any Workstation is reseted to its "safe" state next time it boots -- the User cannot destroy anything and so on. The disadvantage of this program is that we have to disable the protection of the workstations, reboot (in unprotected state) and then copy/install whatever. If it's possible now to login via VNC without another reboot we can safe a lot of time...

By the way: The Logoff is quite easy --> psexec -d \\Workstation logoff.exe

Edited by White_Rabbit
Link to comment
Share on other sites

Ok, meanwhile I had time to take a look at UltraVNC. The logon via Windows authentification works -- but I am still seeking an option where to logon to all clients in a PC-pool at the same time?!? Is that possible with UltraVNC, too?

If not I would still like to write an easy Auto-It-Script but as I am a newbie to that I need some help with it anyway.

Here is what I found so far -- of course it's not finished like this and wont work neither.

But maybe someone knows how to complete it??? Thank you :P

CODE
Local r=AutoIT_Init()

For $i = 1 to 34 Step 1

MsgBox(0, "Logon all Clients via VNC")

Run("psexec \\ws$i\C$\Programme\VNC\winvnc.exe -service")

Delay 1000

Run("C:\Programme\VNC\vncviewer.exe")

ControlSend(" <where>", "", "<what>", "{CTRL + ALT + DEL}")

Send("Login-Name (i.e. Administrator) - maybe a choice of 3 or 4 different names possible??")

Send("Password")

Send("{ENTER}")

WinClose ("vncviewer.exe")

#First Client should be logged in now?

Run("pskill \\ws$i\C$\Programme\VNC\winvnc.exe")

Next

MsgBox(0,"", "All clients are logged on?!?")

End

Edited by White_Rabbit
Link to comment
Share on other sites

Any ideas?

hi! i am also a bloody noob to auto-it and i am using it just to automate my daily admins-work...

so i just run the way i usually do it with autoit... :P

;Workstation R15 (mrs. secretary)
$text = "r" & $1
run("C:\Programme\RealVNC\VNC4\vncviewer.exe")
Opt("WinWaitDelay", 2000)
Sleep(1000)
WinWaitActive("VNC Viewer : Connection Details", "", 5)
Sleep(1000)
send ($text, 1)
Sleep(1000)
send ("{ENTER}")
Sleep(1000)
    If WinExists("VNC Viewer : Authentication [No Encryption]") Then
        vnclogin ()
        Else
            if WinWaitActive("VNC Viewer : Error", "", 5) Then
                WinClose ( "VNC Viewer : Error")
            EndIf
    EndIf


; Login! und Ausführung "CURRENT TASK"
Func vnclogin ()
    send ("vnc-password", 1)
    send ("{ENTER}")
    Sleep(15000)
    if WinWaitActive("VNC Viewer : Question", "", 5) Then
        vnc_logon_failure ()
    EndIf
    
    send ("^+!{DEL}")
    Sleep(2000)
    Send("+{TAB}")
    send ("admin-login")
    send ("{TAB}")
    send ("admin-password")
    send ("{TAB}")
    send ($text, 1)
    send ("{ENTER}")
    WinWaitActive($text, "", 20)
    sleep (90000)
    
; Ausführung "CURRENT TASK"
    Sleep(2000)
    send ("#r")
    Sleep(2000)
    send ("xcopy Z:\temp\Skripts\current_task.exe c:\temp\")
    send ("{ENTER}")
    sleep (5000)
    send ("j")
    Sleep(2000)
    send ("{ENTER}")
    Sleep(2000)
    send ("#r")
    Sleep(2000)
    send ("c:\temp\current_task.exe")   
    Sleep(2000)
    send ("{ENTER}")
EndFunc

i guess that there are a lot of ways to do this much more elegant, but huh, maybe i will learn it some day... ;)))

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...