Edit a GPO field from a script

Home Forums Client Operating Systems Windows 7 Edit a GPO field from a script

This topic contains 8 replies, has 4 voices, and was last updated by Avatar Anonymous 7 years, 5 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • Avatar
    DYasny
    Member
    #158970

    Hi all,

    Lots of Win7 VMs, that I want to automatically shutdown when a user logs off. My problem is I cannot start gpedit.msc on every machine, and edit user config -> windows settings -> scripts (logon/logoff)

    Simply placing a cmd file in %WINDIR%System32GroupPolicyUserScriptsLogoff also doesn’t work – I need to enable the policy somehow.

    AD is not an option in this case.

    So my question is – is there a way, within a script, to place the cmd script in the right location and also update the GPO that uses this cmd file?

    Avatar
    Anonymous
    #371408

    Re: Edit a GPO field from a script

    What you want to do is:

    *-Copy the cmd file to the …scriptslogoff folder on each machine
    *-Manually change the local security policy on that machine to include the script
    *-Export the new security setting as a *.inf file
    *-Use ‘secedit’ to import that *.inf on each machine

    Check out this link I found thru our friend :google::
    http://www.itninja.com/blog/view/using-secedit-to-apply-security-templates

    Avatar
    DYasny
    Member
    #289414

    Re: Edit a GPO field from a script

    thanks, secedit was the missing piece here. I was thinking in the direction of creating a .reg file

    Rems
    Rems
    Moderator
    #228202

    Re: Edit a GPO field from a script

    I am not sure the logoff script policy configuration, and the script file itself, will all part of the inf file. You might instead of using secedit, have to copy all content of the %systemroot%system32grouppolicy folder and replace the content of the grouppolicy folder on the target computers http://www.frickelsoft.net/blog/?p=31 (make backups first).

    note.
    In case you did, the logof script cannot use the shutdown.exe command to shutdown the computer. Regular users are not allowed to shutdown the computer by using a shutdown.exe command.

    /Rems

    Avatar
    Dumber
    Participant
    #201894

    Re: Edit a GPO field from a script

    Since you mentioned Windows 7 VMs, are you using VMware View, XenDesktop or such?

    Avatar
    DYasny
    Member
    #289416

    Re: Edit a GPO field from a script

    RHEV for Desktops actually

    Avatar
    Dumber
    Participant
    #201895

    Re: Edit a GPO field from a script

    Ok, that is one of the few I don’t know, but I do know that other virtual desktop products can do this like view and xendesktop.
    Is there not an option within the RHEV for Desktops?

    I searched through RHEV for Desktops administration guide, and it seems it isn’t possible

    Avatar
    DYasny
    Member
    #289417

    Re: Edit a GPO field from a script

    What do you mean by “this”? A xendesktop or view VM gets turned off when a user logs off?

    I am currently exploring the options of implementing this in RHEV

    Avatar
    Dumber
    Participant
    #201897

    Re: Edit a GPO field from a script

    Well it are options within Citrix XenDesktop and VMware View. You can choose what to do when a user logs off. For more info about VMware View
    http://pubs.vmware.com/view-50/index.jsp?topic=/com.vmware.view.administration.doc/GUID-EE476A53-8D76-4B72-AFF8-AFD8C0791ECC.html

    Also see a bit more info in this image. Especially the disconnect and power control options
    290069.jpg

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.