Sign in to follow this  
Followers 0
Jasu

Cannot get script to work

4 posts in this topic

Hiya All,

First time forum user here and quite new to AutoIT

Love the possibilities now that I found it.

Have an issue. For some reason, the company I work for is using AVG as their AV solution.

Well, the license has run out and they are going to a new product, rolling out the new product is easy (GPO).

However, I need to get AVG off of these systems and the problem I am having is that, for some reason they are not all on the same version.

That makes it so I cannot simply do an uninstall - even when I can on the multiple versions, the uninstall routines are not working all the time.

SO, along came avgremover.exe - Now my issue is that our end users... well they're end users. So, I need to automate a simple utility a tad...(if I tell end users to click a button, they'll bypass it so the system doesn't reboot). No issues so far with using AutoIt.

Except! And I bet you can guess my next issue.... It needs admin rights.

I have a domain user with desktop admin rights that we use for various software installs; however, I cannot get the compiled AutoIt script to run while using the RunAs command. It seems like it starts the avgremover.exe file; however, it doesn't fully run.

If you're not familiar with that avgremover.exe utility. Well it does a quick wipe of the sytem to get rid of AVG - works for my needs here.

Anyway, it pops up a cmd window in the background with a few commands and then pops up a Msg Box, asking you to click on Yes or No - If you click Yes then the rest of the utility's commands are written to that cmd window.

It seems that, the script itself stops the entire avgremover.exe process. I come to that conclusion because I see the 'Click Yes or No' Msg box pop up, and then both that Msg box and the cmd window go away.

If I do a simple Run command, I get the entire script to run perfectly (I have admin rights on my system).

Once I use the below code (a very simple three lines) is where I have issues.

RunAs ("DT_Admin", "OurDomain", "pword", 4, "I:\AVG\avgremover.exe")
WinWaitActive("Warning", "&Yes")
Send("!Y")

Any ideas GLADLY ACCEPTED! Thanks Ahead of time,

JustASadUser (JASU)

Share this post


Link to post
Share on other sites



If you are running this as another user, via a scheduled task, or when the console is locked, then no window can be "ACTIVE". That doesn't mean they don't exist, just that none can be in the "ACTIVE" state. So use WinWait(), WinExists(), etc. to detect windows.

And never use Send() if you can help it. ControlSend() allows specifying the target window, so the active state doesn't matter.

:mellow:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

If you are running this as another user, via a scheduled task, or when the console is locked, then no window can be "ACTIVE". That doesn't mean they don't exist, just that none can be in the "ACTIVE" state. So use WinWait(), WinExists(), etc. to detect windows.

And never use Send() if you can help it. ControlSend() allows specifying the target window, so the active state doesn't matter.

:mellow:

Hmmm, that all makes sense. Thanks PsaltyDS

Now I just can't get that button to click...

RunAs ("DT_Admin", "OurDomain", "pword", 4, "I:\AVG\avgremover.exe")
If ProcessExists("avgremover.exe") Then
    ControlSend("Warning","&Yes","[CLASS:Button; INSTANCE:1]","{ENTER}")
EndIf
Edited by Jasu

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