WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

How To
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Modify Local Group Policy

 Keywords: Local Group Policy Modify Change Script Registry 

Question:

I wish to disable the 'Display Shutdown Event Tracker' on my Windows 2003 servers, using WinBatch. Does anyone have any ideas on how I might best acheive this ?

Answer:

Why not just modify the GPO for the domain?

Unfortunately Windows doesn't seem to offer any direct functionality to automate individual policy settings. I believe most of this information is stored in the registry. The trick would be to figure out all of the necessary registry modifications, then reproduce that using the Registry functions in WinBatch.

If you can't find specific registry values online then one option would be to run a registry monitoring tool, like Regmon, while you modify the settings manually.

More:

These registry key looks interesting:
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Reliability] 
"ShutdownReasonOn"=dword:00000000
Reference: http://social.technet.microsoft.com/Forums/en/winservergen/thread/7220b4d5-7c3c-44c8-a055-98ef322951b6

See Also: http://www.askvg.com/how-to-disable-remove-annoying-shutdown-event-tracker-in-windows-server-2003-2008/


Undebugged Code Sample:

;
;               Modify Local Group Policy Setting
;
; Disable "Shut Down Event Tracker" (Shut Down Reason UI) in Windows NT, XP, Vista, Windows 7, Windows 8, Server 2003 and 2012.
;
; Reference: http://www.askvg.com/how-to-disable-remove-annoying-shutdown-event-tracker-in-windows-server-2003-2008/
;
; Registry Keys:
; Win VISTA/7/8/2008/2012: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Reliability
; Win NT/XP/2003: HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Reliability
;
; Values: If the DWORD values are not present, create them.
; ShutdownReasonOn
; ShutdownReasonUI

state = @OFF  ;Disable @On = Enable

ver = StrSub( WinVersion(5), 1, 3 )

win_2_5 = 'SOFTWARE\Microsoft\Windows\CurrentVersion\Reliability'
win_2_6 = 'SOFTWARE\Policies\Microsoft\Windows NT\Reliability'

value1 = 'ShutdownReasonOn'
value2 = 'ShutdownReasonUI'

; Win Version VISTA / 7 / 8 / 2008 / 2012
If Ver == "2-6"
   ret = RegExistKey(@REGMACHINE, Win_2_6, 64 )
   If ret == 0 Then RegCreateKey(@REGMACHINE, Win_2_6, 64 )
   RegSetDword(@REGMACHINE, Win_2_6:'[':value1:']', state, 64 )
   RegSetDword(@REGMACHINE, Win_2_6:'[':value2:']', state, 64 )
EndIf

; Win Version NT / XP / 2003
If Ver == "2-5"
   ret = RegExistKey(@REGMACHINE, Win_2_5, 64 )
   If ret == 0 Then RegCreateKey(@REGMACHINE, Win_2_5, 64 )
   RegSetDword(@REGMACHINE, Win_2_5:'[':value1:']', state, 64 )
   RegSetDword(@REGMACHINE, Win_2_5:'[':value2:']', state, 64 )
EndIf



Article ID:   W17941
Filename:   Modify Local Group Policy.txt
File Created: 2013:01:08:09:07:54
Last Updated: 2013:01:08:09:07:54