Sign in to follow this  
Followers 0
AngryGnome

Dismissing Dialog Box Without Active Login Session

6 posts in this topic

Okay, okay, okay. I know that this question has been asked before and the short answer is "Can't be done". More on that in a sec.

Also with the okay, okay, okay, I know that the first question people will have is "There aren't a lot of valid reasons to want to do this. You're not doing anything unethical are you?"

To forestall the second objection, here's my situation. I'm working on a custom report at work. We have a client with a source database that we need to pull information from. We can only access that database while connected to their vpn. While connected to their vpn, our server loses connection with our local network. Because the job needs to run late at night, and because I don't feel like hanging around the server room until midnight every night, I'm trying to automate the process using AutoIt. I have a script that does everything I need it to, provided that there's an active login session. However, if the login session goes away (screensaver locks session, computer reboots, etc) the script breaks because WinWaitActive and ControlClick stop working. The kicker of it all is that the vpn, when it connects throws up a security banner. If I could figure out how to click "OK" on this banner without a login session, everything would be hunky-dory.

Hopefully, this convinces you that I'm not up to no good. :think:

Which brings me back to the first objection. I know it can't be done with existing AutoIt functions. What I'm trying to figure out right now (in my very painful, java developer, this Windows internals stuff is all greek to me way) is a way to use DllCall to dismiss that darn security banner. (Or, atlernatively (and I know this brings up the hacker specter again) figure out a way to automate a login)

If any of the AutoIt developers could give me a nudge in the right direction, I'd greatly appreciate it. I'd even be willing to hear "can't be done" again if I could get a bit more detail about why it can't be done.

Anyway, many thanks in advance.

Code snippet below. (There's obviously a lot more, but this is the part that fails.)

-------------

$vpnPid = Run("path_to_vpn_exe")
WinWaitActive("Security Banner")
ControlClick("Security Banner","",1)

Share this post


Link to post
Share on other sites



The kicker of it all is that the vpn, when it connects throws up a security banner. If I could figure out how to click "OK" on this banner without a login session, everything would be hunky-dory.

try this

Send("{TAB}")
Send("{ENTER}")

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

While connected to their vpn, our server loses connection with our local network.

1st solution - Why not use 2 Card's. Most VPN (Like secure client) bind themselves to a single nic. Then simply point each NIC to a seperate command... Moving on.

However, if the login session goes away (screensaver locks session, computer reboots, etc).

Mouse move should stop the screensaver, reboots can be handled by putting your script in startup and auto-logon being enabled.

(figure out a way to automate a login)

Try this... It is OS dependent but it should work for you.

Regkey = HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon

Those keys can be manipulated to allow an autologon. AutoAdminLogon must be changed to 1 (or created and set to 1 if it didn't exist). Then you populate DefaultDomainName, DefaultPassword, DefaultUserName. Again if they don't exists create them and populate them. They are all REG_SZ values.

Finally set, or create, ForceAutoLogon and set it to 1(Also a REG_SZ).

This will take care of all of your issues.


"I have discovered that all human evil comes from this, man's being unable to sit still in a room. " - Blaise Pascal

Share this post


Link to post
Share on other sites

I feel the need for a quick warning. Use this at your own risk, auto-logon (especially with an account that has strong rights) is dangerous for your proffesional enviornment. It is strictly forbidden by most of my clients and your office may have similar regulations...

-I feel better now-


"I have discovered that all human evil comes from this, man's being unable to sit still in a room. " - Blaise Pascal

Share this post


Link to post
Share on other sites

Just a quick note to say thanks to those who offered suggestions. The auto-login thing doesn't work (because of the requirement to hit crtl-alt-del, and ironically enough because of a security banner put up by my company).

I'm working on a VBScript work-around that is showing some promise but doesn't work just yet.

My main tack now is to redouble my efforts to convince management that this is not a feasible solution, and if we could just require the client to send us the data (like we do with all our othe projects) things would be much easier and bulletproof.

If I figure out a solution, I'll post it here for the good of the community.

Share this post


Link to post
Share on other sites

Why not get the other end to run the job locally at their end, hanging off their scheduler and put the results where you can FTP or COPY them back to your system, again via a local scheduler job? At the other end you could have the job pause after generation, wait a pre-determined time and then delete the results to reduce the time window the results are available (for security reasons). Alternatively, if you have write access on the remote system, write a small file back to their server as a flag to say you got the report file, and then the remote end can look for that flag file after generating the report and as soon as it finds it, delete the report file and flag file until another night.

XML?

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