Jump to content

Using AutoIt to edit/change settings in gpedit.msc


GTFK
 Share

Recommended Posts

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.

Link to comment
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]

Link to comment
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]

Link to comment
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.

Link to comment
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- #
Link to comment
Share on other sites

  • 1 year later...

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.

Link to comment
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.

Link to comment
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]

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