Sign in to follow this  
Followers 0
btitguy1

Trying to Change Group Policy will not send to MMC

5 posts in this topic

I created a very simple script to open gpedit.msc

I am trying to send the alt commands to the mmc window to disable local group policies.

When the script runs it will not insert the alt commands to the MMC.

I am a newbie to Autoit but this seems like it should be really easy.

Below is my script. Can someone help me out? I have 200+ (non domain) machines waiting for this.

Run("cmd.exe")

WinWaitActive("C:\Windows\system32\cmd.exe","","")

Send("gpedit.msc{enter}exit{enter}")

Send("!A!R")

Send("!C!Y!U{ENTER}!F!X")

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I have tried several different ways to send the Alt keys. i have tried {ALT} {ALT DOWN} AR{ALTUP}. I am at my wits end with this.

In testing i changed to notepad instead of gpedit.msc. the {ALT}fx{TAB}{ENTER} worked to close notepad without saving.

I am curious as to why the mmc window will not see the {ALT} commands?

Here is the latest script

Send("#r")

WinWaitActive("Run")

Send("gpedit.msc{Enter}")

Sleep(5000)

Send("{ALT}")

Edited by btitguy1

Share this post


Link to post
Share on other sites

It seems some management windows in Windows7 are protected from Virtual keystrokes... I also tried to do a similar script to check actual path of shares via Computer Management and ran into the same issue you are having... no solution so far.

You could always use "the back door" and get the same results via WMI or object manipulation but that can be done with VBscript or powershell... not sure why AutoIt seems to be going that way

Share this post


Link to post
Share on other sites

Found something!!!!

In order to bypass this Windows7 security where "protected" windows ignore virtual key strokes (assuming that is the real issue)... you need to do 2 things:

1) add #requireadmin at the beginning of your script; this will require you to accept the Windows 7 security warning

2) make sure the script is running locally, I had it on a share and it gave me an error if I ran it from there even with the #requireadmin added

My script is interacting with the Computer Management window now (compmgmt.msc)

Share this post


Link to post
Share on other sites

You know you can do this with command line.

http://www.google.com/search?source=ig&hl=en&rlz=1G1ACAW_ENUS402&=&q=group+policy+command+line&oq=group+policy+command+l&aq=0&aqi=g5g-v5&aql=&gs_sm=c&gs_upl=634l9028l0l12134l24l24l1l1l1l1l316l4374l0.9.12.1l22l0

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