Jump to content

Enable/Dsiable Group Policy settings


Recommended Posts

In a earlier topic http://www.autoitscript.com/forum/index.ph...topic=27147&hl= i have asked how to enable some programs in Add/Remove Programs.

The solution was ControlCommand, But.....

This doesn't work in the group policy editor. If you wanna know what a Group policiy editor is you can go to your Start > Run > type "gpedit.msc". On Xp and 2003 it will open a group policy editor where you can set some restriction for the user or computer where you are enabling it.

So be carefull, if you don't know what your dealing with then don't adjust the settings and leave them. Just put them back to NON-configured as it is in default. Then nothing happens.

Back to my story.... If i use ControlCommand in the group policy editor it doesn't work. Am i doing something wrong? or is there an other command wich could be more usefull for me?

I know you download group policy management console and export and import it, but this works only on the same machine.

Edited by Iznogoud
Link to comment
Share on other sites

  • Replies 42
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

No solution? Is the only possibily then with 4 times arrow down then press enter then press tab etc etc.? :D

Look into NTrights.exe, which is well-documented on the web, and comes with XP Pro. I use it in a script to change user rights, and I *think* it works for group policies also. You may need to prompt the user for the Windows password and then plug the password into the command (at least that's what my script needs to do).

Edited by Edward Mendelson
Link to comment
Share on other sites

Look into NTrights.exe, which is well-documented on the web, and comes with XP Pro. I use it in a script to change user rights, and I *think* it works for group policies also. You may need to prompt the user for the Windows password and then plug the password into the command (at least that's what my script needs to do).

nope thats not a option, you can do alot of things with that program but not setting group policies.

Link to comment
Share on other sites

Have you seen this thread in the Developers forum yet?

http://www.autoitscript.com/forum/index.php?showtopic=9988

Not untill now :D

Only problem is that i can understand now the basics of AutoIT with some area better then other. But this code in that thread :D

Ok the first part is C i think, but when it comes to AutoIT with the files of Tweast its become some what easier.

I will try this, hopefully i can get it to work.

Link to comment
Share on other sites

I have a problem with selecting the listview items. I posted also a question at the developers area, so dont know if i need to post it here too.

----------------------------------------------------------------------------------------------------------------

The select tree does work fine, but how can i select things in a listview?

I am trying to make a script wich enables alot of policy settings.

I described my situatie at: http://www.autoitscript.com/forum/index.ph...topic=27426&hl=

Is there a way to do this?

----------------------------------------------------------------------------------------------------------------

Link to comment
Share on other sites

:D that simple? , i will try it right away :">

If you would please let me know once you get this all worked out. I also need to manipulate the group policy, not to mention create a user and set up some options for him.

It would just make my job easier if I didnt have to manually set the same settings 35 times throughout our network.

Thanks,

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

If you would please let me know once you get this all worked out. I also need to manipulate the group policy, not to mention create a user and set up some options for him.

It would just make my job easier if I didnt have to manually set the same settings 35 times throughout our network.

Thanks,

JS

I will, but if i look at your post count :D you have more skill then i do, unless you only reply rubbish :D

But eej, i will help for as far i can.

Link to comment
Share on other sites

Why doesn't this work?

WinWait ( "Group Policy Object Editor" )
WinActivate ( "Group Policy Object Editor" )
WinWaitActive ( "Group Policy Object Editor" )
ControlListView ( "Group Policy Object Editor", "", "SysListView321", "Select", 'Remove Documents menu from Start Menu' )
;Send("{ENTER}")

I just used the basics wich was a working script with ControlCommand. I adjusted the values with help from the Help file. But still doesn't work :D

-edit-

WinWait ( "Group Policy Object Editor" )
WinActivate ( "Group Policy Object Editor" )
WinWaitActive ( "Group Policy Object Editor" )
ControlListView ( "Group Policy Object Editor", "", "SysListView321", "Select", 3 'Remove Documents menu from Start Menu' )
;Send("{ENTER}")

After select if i put there numbers from 0 to a maximum of the listview it does get selected. How can i let it select by name and not count the lines and give them numbers?

Edited by Iznogoud
Link to comment
Share on other sites

  • Moderators

My title is different than yours :D

$Title = "Group Policy"
$Item = ControlListView($Title, '', 'SysListView321', 'FindItem', 'Remove Documents menu from Start Menu')
ControlListView($Title, '', 'SysListView321', 'Select', $Item)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

you can manipulate policy settings in the registry also... i have a book somewhere that lists the registry keys created/modified for each of the options in group policy. i'm sure you can find a reference on the web, or even just muddle through it (assuming you're comfortable playing in the registry and accept the associated risk)... i am pretty sure the machine policies were in....

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies

you can also find more policy settings in the user sections of the registry...

Link to comment
Share on other sites

My title is different than yours :D

$Title = "Group Policy"
$Item = ControlListView($Title, '', 'SysListView321', 'FindItem', 'Remove Documents menu from Start Menu')
ControlListView($Title, '', 'SysListView321', 'Select', $Item)
Indeed, ok your code is better with the variables. Thats one thing i much learn to use more variables instead of typing the same all over again. And your script is doing is job almost perfect :P

The select command is not selecting the item but it puts it in a brown area and not blue wich is normal if you select it. How can i really select it so i can send a key like {ENTER} to get the properties of it to enable the option?

you can manipulate policy settings in the registry also... i have a book somewhere that lists the registry keys created/modified for each of the options in group policy. i'm sure you can find a reference on the web, or even just muddle through it (assuming you're comfortable playing in the registry and accept the associated risk)... i am pretty sure the machine policies were in....

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies

you can also find more policy settings in the user sections of the registry...

The policies are the same for windows 2000/xp/2003 even some for Windows 98 and the registry is not. And you won't want to adjust the registry of each pc to activate these restrictions. You want to manage them in one place. But i nice and good alternative way, but if i see what AutoIT can do espicially in the hand like the top posters on this forum for an example Smoke_N, the options are almost unlimited. So this must work also in some way ;)

-edit-

I have done it like this now, but i know or there must be a better way:

$Title = "Group Policy"
WinWait($Title)
WinActivate($Title)
WinWaitActive($Title)
$Item = ControlListView($Title, '', 'SysListView321', 'FindItem', 'Remote programs on Settings menu')
ControlListView($Title, '', 'SysListView321', 'Select', $Item)
Send("{TAB}")
Send("{ENTER}")
Sleep(2000)
Send("{ENTER}")

$Item = ControlListView($Title, '', 'SysListView321', 'FindItem', 'Remote My Network Places icon from Start Menu')
ControlListView($Title, '', 'SysListView321', 'Select', $Item)
Send("{TAB}")
Send("{ENTER}")
Sleep(2000)
Send("{ENTER}")

For an example, i just open the properties and do a 2 sec sleep instead of activating. Don't wanna change settings automatic untill i know for sure it does work :D

Edited by Iznogoud
Link to comment
Share on other sites

  • Moderators

Local $Title = "Group Policy"
Local $TextToFind = 'Remove Documents menu from Start Menu'
Local $ClassName = 'SysListView321'
Local $Item = ControlListView($Title, '', $ClassName, 'FindItem', $TextToFind)
ControlListView($Title, '', $ClassName, 'Select', $Item)
ControlSend($Title, '', $ClassName, '{ENTER}')

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Indeed, ok your code is better with the variables. Thats one thing i much learn to use more variables instead of typing the same all over again. And your script is doing is job almost perfect :D

The select command is not selecting the item but it puts it in a brown area and not blue wich is normal if you select it. How can i really select it so i can send a key like {ENTER} to get the properties of it to enable the option?

The policies are the same for windows 2000/xp/2003 even some for Windows 98 and the registry is not. And you won't want to adjust the registry of each pc to activate these restrictions. You want to manage them in one place. But i nice and good alternative way, but if i see what AutoIT can do espicially in the hand like the top posters on this forum for an example Smoke_N, the options are almost unlimited. So this must work also in some way :D

smoke definitely knows his stuff, that's for sure... i'm pretty sure i've used the same registry locations to set policy on 98,xp, and 2k. the only thing that i've run into that could be considered a snag was that older versions of windows had fewer options. i wouldn't suggest completely managing group policy by registry unless there was really no other way, but it helped me out at my last company when we had i had to modify group policy as a non administrator.
Link to comment
Share on other sites

Local $Title = "Group Policy"
Local $TextToFind = 'Remove Documents menu from Start Menu'
Local $ClassName = 'SysListView321'
Local $Item = ControlListView($Title, '', $ClassName, 'FindItem', $TextToFind)
ControlListView($Title, '', $ClassName, 'Select', $Item)
ControlSend($Title, '', $ClassName, '{ENTER}')
You are the man :D

You can go to sleep with a good feeling :D

This works great, and even better then my worse code.

So if i want to adjust more then one i can simple use these lines to adjust the TextToFind?

Local $TextToFind = 'Remove Documents menu from Start Menu'
Local $Item = ControlListView($Title, '', $ClassName, 'FindItem', $TextToFind)

ControlListView($Title, '', $ClassName, 'Select', $Item)
ControlSend($Title, '', $ClassName, '{ENTER}')

And just change the value 'Remove Documents menu from Start Menu' in the next value wich must be selected?

smoke definitely knows his stuff, that's for sure... i'm pretty sure i've used the same registry locations to set policy on 98,xp, and 2k. the only thing that i've run into that could be considered a snag was that older versions of windows had fewer options. i wouldn't suggest completely managing group policy by registry unless there was really no other way, but it helped me out at my last company when we had i had to modify group policy as a non administrator.

True, in case of no other solution the registry is a good way to restrict and adjust settings. Everything is possible, but policy are just a bit easier then registry settings, in case of manage and deploying. Edited by Iznogoud
Link to comment
Share on other sites

So if i want to adjust more then one i can simple use these lines to adjust the TextToFind?

Just use it in Function:

Func OpenItem($TextToFind)
    Local $Title = "Group Policy"
    Local $Item = ControlListView($Title, '', 'SysListView321', 'FindItem', $TextToFind)
    ControlListView($Title, '', 'SysListView321', 'Select', $Item)
    ControlSend($Title, '', 'SysListView321', '{ENTER}')
EndFunc

OpenItem('Remove Documents menu from Start Menu')
OpenItem('Remote programs on Settings menu')
OpenItem('Remote My Network Places icon from Start Menu')
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...