Jump to content

Issue with locked server and script.


Recommended Posts

Hello all! I have been using AutoIT for quite a while to automate installs. Recently I started using it to automate some task that I was told couldnt be automated. Long story short I wrote a script and then compiled to an .exe. The both the script/exe work fine when I run it manually while on the desktop of the server, but when I schedule it to run it does not work. I can see the reason is that when it launches the program I call in the script it is not the active window. So the "WinWaitActive" command is waiting for that window to become active. When I logon to the server and simply click the program to make the window active it runs the rest of the steps no problem.

Now the drawback here is that we are on an Active Directory environment of a large corporation (100-200 domains), but do have full control of all our stations/users. Corporate has a station lock policy set to every 15 minutes so when a server or computer is in active for 15 minutes it locks the computer and there is no way around it. This means the script will be scheduled to run while the computer is locked. I tried working with the WinActivate command, but it didnt seem to work. I have researched this here and elsewhere and tried some differnt scripts people have wrote with no luck. Any thoughts or ideas? After pumping about 36 hours into trying to figure this out I decided to seek some help from the masters so dont consider me a troll not wanting to try to solve it myself or being lazy...just sort of stuck!haha. My script is below. Thanks!-Vince

Run ("ReNamer.exe")

WinActivate ("ReNamer.exe")

WinWaitActive ("ReNamer")

Send ("{ALT}")

Send ("{RIGHT 2}")

Send ("{DOWN}")

Send ("{RIGHT}")

Send ("{ENTER}")

Send ("{ALT}")

Send ("{DOWN 4}")

Send ("{ENTER}")

WinWaitActive ("Open")

Send ("{TAB 7}")

Send ("{DOWN}")

Send ("{ENTER}")

Send ("{ALT}")

Send ("{DOWN 6}")

Send ("{ENTER}")

Send ("{ALT}")

Send ("{DOWN 7}")

Send ("{ENTER}")

WinWaitActive ("Information")

Send ("{ENTER}")

Send ("{ALT}")

Send ("{DOWN 8}")

Send ("{ENTER}")

Link to comment
Share on other sites

Hi and Welcome to the forum!

When the computer is locked there's no active window, see the FAQ.

Why doesn't my script work on a locked workstation?

Link to comment
Share on other sites

Vince

Two things. First does the application you are trying to interact with support command line?

Second, using send and winwaitactive counts on you having access to the application directly and it having focus. Using controlsend is a better option for if one loses focus to the control, your script is less likely to fail.

Link to comment
Share on other sites

Thanks for the warm welcomes! Oh my! A bit embarrased...Sad part is I did indeed look through the FAQ section and documentation before researching on the web. I played with this some more and here is a kicker...even when the computer is not locked the script fails to run from the windows scheduler...correction the script runs fine but when I connect to the server to look at the screen the program is not in focus...I go to it click the program and it works fine as expected. So it does not appear to be related to the locked computer after all. I scheduled the script to run within that 15 minute window before the computer locked. I will look into this controlsend command. The program does not appear to support command line options no. It is a program named "ReNamer" by Denis Kozlov.

Now I dont believe this is a factor, but I do all my work on servers via Remote Destkop with the /admin switch to mimic being at the actual station (not a session). I am not standing in front of the physical server. Thanks again for all your time and reccomendations folks.

Edited by win2kpatcher
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...