Moderators JLogan3o13 Posted November 24, 2010 Moderators Share Posted November 24, 2010 I've been working on a script for connecting to remote machines, and would appreciate some suggestions on fine tuning it. I connect to a large number of remote machines at one time for part of my daily activities (anywhere from 10-30 at a time). Normally this would not be an issue, but one customer of mine employs a management application called ScreenPass. This application causes a uniquely irritating double login through RDP. When launching the RDP session, you enter your credentials and hit ok. The screen then goes blank for approximately two minutes, after which the login screen reappears and you have to enter the credentials again. I'm attempting to create a script that will automate the second login for me. Below is what I've tried thus far: My thought is to wait until the 2 minutes has elapsed and they are all back at the login screen, and then run the script. Then I can just cycle throgh the windows by clicking through them, and allow the script to input the credentials. Created an array for the RDP windows: Local $pc[6] $pc[0] = "pc0 - Remote Desktop" $pc[1] = "pc1 - Remote Desktop" $pc[2] = "pc2 - Remote Desktop" $pc[3] = "pc3 - Remote Desktop" $pc[4] = "pc4 - Remote Desktop" $pc[5] = "pc5 - Remote Desktop" Create a loop of some sort that recognizes the active window and then reenters the credentials: Tried with a switch - While 1 Switch $pc Case WinActive($pc[0]) ;enter credetuals Case WinActive($pc[1]) ;enter credetuals Case WinActive($pc[2]) ;enter credetuals Case WinActive($pc[3]) ;enter credetuals Case WinActive($pc[4]) ;enter credetuals Case WinActive($pc[5]) ;enter credetuals EndSwitch WEnd Also tried a For loop - While 1 For $element in $pc If WinActive($element) Then ;enter credentials EndIf Next WEnd In both cases, the script works just fine IF the windows are brought up in order (1-5). However, if I happen to lose connection to #3, for example, the script will not execute on #'s 4, 5, or 6. I'm looking for the cleanest way to have the script enter the credentials regardless of the order of windows that becomes active, whether its 1-6, 2-4 and then 5 and 6, etc. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
MrMitchell Posted November 24, 2010 Share Posted November 24, 2010 I had the same problem but I disabled the credentials window inside the remote system (by making a change to the way I connect) then also enabled network level authentication on my machine. Now when I run "mstsc /v:servername" it goes right in without any login windows on either side. You might consider one or both of these options if you are able to. Both are changes that can be made on your side, not the remote system. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted November 24, 2010 Author Moderators Share Posted November 24, 2010 Thanks for the response. I thought about going this route as well, but I am making the connection from XP 64bit to XP 32bit machines. I have not been able to enable NLA for the 64bit XP machine, even after changing the reg keys as suggested. All of the material I've read on TechNet seems to point to it not being possible. You are correct, though, that it would make this a lot less frustrating. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
MrMitchell Posted November 24, 2010 Share Posted November 24, 2010 Bummer...well good luck figuring it all out! Link to comment Share on other sites More sharing options...
SadBunny Posted November 24, 2010 Share Posted November 24, 2010 While 1 For $element in $pc If WinActive($element) Then ;enter credentials EndIf Next WEnd How about changing the loop to first check whether the window exists (WinExists), then activating that window (WinActivate), and then entering the credentials? Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
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