Kuriandungu Posted March 11, 2008 Share Posted March 11, 2008 Hello guys. I'm a bit of a newbie but still remember the old Dos Scripting Days and batch files. I have a rather curious problem. i have some third party printing software that occasionally crashes and since we work 24hrs , we are often get calls at 1am to simply close the error dialog and restart the program. While we await a permanent fix for the crashing program, i'd like to use Autoit to a) allow a user without Admin rights on the server to run a batch file that will 1. Clear all print jobs on que 2. Click "Ok" on the error dialog popup 3. Restart the offending software Thats it. I've been scouring the forum , help files etc and have an idea what to do. What stumps me is how to run the batch file i place on the server (that will do the above 3 steps) as though its running on the server (ie Impersonate the admin and local logon) Any ideas guys (i'm looking at pstools but i'd rather use AutoIt) Thanks! Link to comment Share on other sites More sharing options...
LarryDalooza Posted March 11, 2008 Share Posted March 11, 2008 research psexec... or have a script always running that watches for the error dialog and performs the steps automagically. Lar AutoIt has helped make me wealthy Link to comment Share on other sites More sharing options...
Kuriandungu Posted March 12, 2008 Author Share Posted March 12, 2008 Thanks Lar, Actually i'm using a combination.(or trying to!) I've installed autoit on the server and scripted the neccesary steps to restart the app after purging stuck print jobs. This works on the server. On the user's machine, i use a batch file with psexec to run the script remotely. The problem i'm having now is that whenever i build the exe on the server (from autoit) it doesnt run, i get the error "Unable to Open Script file" Link to comment Share on other sites More sharing options...
Kuriandungu Posted March 14, 2008 Author Share Posted March 14, 2008 I managed to solve my problem using Windows scheduler. First used Autoit to check (Winexists) if the error dialog is there and only then does it kill the old process and start a new one. this is the 3rd day and so far so good. Now, This was not my original intention. I intended to have a batch file on the users desktop and when the error occured they would be able to run it and kill the process etc. I however couldnt get this to work. EVEN using Psexec i found that the Autoit script ran on the server but restarting the application did not restart it in the normal way!. there would be an instance in Task Manager but that instance had no window! (yes i used the @Maximize Option in Run command). Also it causes user requests to crash continously. what is interesting is that on the server, the same script runs without a problem and restarts my app with a visible window and works perfectly. I tried running PSEXEC with admin username and password and with the -i option to allow interactivity but none of this made a difference. Has anybody come across such a problem and how did you solve it? Link to comment Share on other sites More sharing options...
Qball Posted March 14, 2008 Share Posted March 14, 2008 (edited) well i have an idea that might help... runasset('','','') check out this command in the autoit help file then use the run('') command with it. this could let users who arent admin do stuff... you could have this run software that communicates with the server and allow everybody to use the software with admin. but as for the process running in an invisible window.... if when you run the script on the server it comes up as a different user in task manager as when you run the script from a user's desktop, you can put runasset() in the script you run off of your desktop to run it on the server as the correct user. Edited March 14, 2008 by Qball Link to comment Share on other sites More sharing options...
ResNullius Posted March 14, 2008 Share Posted March 14, 2008 I managed to solve my problem using Windows scheduler. First used Autoit to check (Winexists) if the error dialog is there and only then does it kill the old process and start a new one. this is the 3rd day and so far so good.Now,This was not my original intention. I intended to have a batch file on the users desktop and when the error occured they would be able to run it and kill the process etc. I however couldnt get this to work. EVEN using Psexec i found that the Autoit script ran on the server but restarting the application did not restart it in the normal way!. there would be an instance in Task Manager but that instance had no window! (yes i used the @Maximize Option in Run command). Also it causes user requests to crash continously.what is interesting is that on the server, the same script runs without a problem and restarts my app with a visible window and works perfectly.I tried running PSEXEC with admin username and password and with the -i option to allow interactivity but none of this made a difference.Has anybody come across such a problem and how did you solve it?When the user launches the script, are you expecting interactivity on the user's desktop, or on the server? There are some pretty clear guidelines in this SysInternals forum's thread http://forum.sysinternals.com/forum_posts....;PN=1&TPN=2 Link to comment Share on other sites More sharing options...
Kuriandungu Posted March 15, 2008 Author Share Posted March 15, 2008 Thanks Qball, ResNullius for the input, I'll give it a go. Res, the sysinternals link is great. cheers. 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