Sign in to follow this  
Followers 0
GTFK

Using AutoIt to edit/change settings in gpedit.msc

12 posts in this topic

I have 40 laptops that are not part of a domain and I need an easy way to change the gpedit.msc settings to lock down the desktop and screen savers on each laptop. I haven't seen any short cuts for these settings. All of them are set through mouse clicks or system of tabs, arrow keys and enters. The problem is every time and way I've done it, the script always freezes when navigating the Administrative Templates folder. I'm really new to scripting so any advanced help would be appreciated.

Share this post


Link to post
Share on other sites



Try looking into MouseClick() and ControlClick() in the help file. I'm not experienced, but I think this should do the trick.


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

Couple of suggestions

Run("gpedit.msc") to open the window

Then you can use MouseMove(x, y) and MouseClick("left") for the nav.

Use the Info Window to get the mouse coords.

You can also use control handles as suggested by dantay9 but there is not much to grab there.

Lastly post up what you have


Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites

Maybe something like this

ShellExecute("gpedit.msc")

WinWaitActive("Group Policy")
Global $appHandle = WinGetHandle("Group Policy")
MouseMove(117, 297)
MouseClick("left")
; and so on
WinClose($appHandle)

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites

In a nutshell.

The changes made with gpedit are saved to registry.pol files in System32\GroupPolicy\User and \Machine folders.

Make the changes you want on a test laptop and copy over the registry.pol files to the laptops to be locked down.

Deny permissions for the Administrators group to the \User and \Machine folders so the policies don't apply

to admins logging in.

Run gpupdate /force to apply the policies to the computers.

Hope this helps.

Share this post


Link to post
Share on other sites

Gpedit.msc is basically just a frontend for a bunch of registry settings. If you run RegShot before you make a change you can easily find the registry locations.

Share this post


Link to post
Share on other sites

I'm going to try all you suggestions today. Thanks for the help.

Share this post


Link to post
Share on other sites

Gpedit.msc is basically just a frontend for a bunch of registry settings. If you run RegShot before you make a change you can easily find the registry locations.

or Regmon :)

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

Can you please tell me how to get MouseMove(x,y), x and y coordinates?

Thanks

Holy year and a half old thread, Batman!

Instead of using the coordinate route, I suggest you edit the registry directly. Use ProcMon to determine the proper key. ProcMon now includes all the functionality of both FileMon and RegMon.

Share this post


Link to post
Share on other sites

This is all not good practice.

If you have 40 PC's (or more) just put them in a AD group and do a policy on that group.

It is all easier then doing it locally on all PC's.That way if you need to change you will have to do a 1 min policy change

on the AD and it will be updated on all pcs.

Share this post


Link to post
Share on other sites

Can you please tell me how to get MouseMove(x,y), x and y coordinates?

Thanks

You can get them from the mouse section in the autoit info tool. See also MouseGetPos() and MouseCoordMode (Option) in the help file.

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

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