Jump to content

Script won't run when not logged in


Recommended Posts

Hi,

I used the recorder to make this script and it works great except I'd like to be able to schedule it to run when I'm not logged in. Basically, it clicks through a gui for an application that remotely install some software. How would I go about making this work (or something similar) if I'm not logged in.

Opt("WinWaitDelay",100)

Opt("WinTitleMatchMode",4)

Opt("WinDetectHiddenText",1)

Opt("MouseCoordMode",0)

Run('C:\WINDOWS\system32\agentrollout.exe')

WinWait("PatchLink Agent Deployment","")

If Not WinActive("PatchLink Agent Deployment","") Then WinActivate("PatchLink Agent Deployment","")

WinWaitActive("PatchLink Agent Deployment","")

MouseMove(443,365)

MouseDown("left")

MouseUp("left")

Sleep(1000)

MouseDown("left")

MouseUp("left")

Sleep(1000)

MouseMove(185,127)

MouseDown("left")

MouseMove(31,124)

MouseUp("left")

Sleep(1000)

Send("jsmith{TAB}passwordhere")

MouseMove(35,311)

MouseDown("left")

MouseUp("left")

Sleep(1000)

MouseMove(437,362)

MouseDown("left")

MouseUp("left")

Sleep(1000)

MouseMove(64,153)

MouseDown("left")

MouseUp("left")

Sleep(1000)

Send("computername")

MouseMove(453,362)

MouseDown("left")

MouseUp("left")

Sleep(1000)

MouseMove(432,362)

MouseDown("left")

MouseUp("left")

Sleep(1000)

Link to comment
Share on other sites

I used the recorder to make this script and it works great except I'd like to be able to schedule it to run when I'm not logged in.

I do remote automated cleanup of 400+ computers using AutoIT scripts. I run one locally to collect the parameters for which functions to run and create a variable string with nothing but 1's and 4's in it (checked or not checked).

I then send the second app to the target machine using PSEXEC from Sysinternals and pump in the variable as the command line parameter. The second program is "gui-less", but takes its commands from the command line input and runs only those cleanup apps that I've selected in the first script.

You need to re-write your script without mouse moves, and replace them with winwait/ctrlclick/run/runwait commands instead. With the proper permissions your program will run on the target machine whether or not any user is logged in. In fact, I've found that my clean up app runs even if a user logs in and then logs off again... Of course, I have admin priviledges to do all this...

Edited by jefhal
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
Share on other sites

Ok, I thought I may have to re-write it the other commands. I had some trouble so I tried the recorder and it worked. I'm testing it tonight. I have an RDP /console session open from my desktop at work to a windows 2003 server where the script is and the app I'm controlling with the script. I can't pass in any variables to this app and it's proprietary, no scheduling. I had to disable the password authentication/screensaver which prevented the script from running and it seems to run as long as I stay logged into the server from my desktop - even a disconnect session won't allow the script to run - it runs after authenticating - which would probably get me fired if this happens at the wrong time. :D

Link to comment
Share on other sites

it runs after authenticating - which would probably get me fired if this happens at the wrong time. :wacko:

I hear you. I fired off my script a few times when teachers were still logged in. Scared the heck out of them. Now I do a check first to see if a. the machine is on, b. if anyone is logged on (I use Sysinternals psloggedon.exe for that part)... :D
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
Share on other sites

Group policy can run AutoIt scripts. Adding the procedure to a Startup or Shutdown script will allow your script to run when no one is logged on.

Using active window functions may not work at this period. Use WinWait and Control*() functions that do not require active windows.

Link to comment
Share on other sites

Now I do a check first to see if a. the machine is on, b. if anyone is logged on (I use Sysinternals psloggedon.exe for that part)... :D

Just checking for explorer.exe running will tell you if anyone's logged on.

You could then run it with a pop-up saying something like "Important System Mainenance needs to run, click OK to continue" or something like that.

"I'm not even supposed to be here today!" -Dante (Hicks)

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...