none
Batch File or script to change reg value - how to set reg values from GP?

    Question

  • Hi,

     How are you? May I ask how to write a script to change the value in regedit?

    Issue: Every time my computer goes to sleep, it wakes up with 640x800 resolution.

    Solution:

    1. Path is HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\Configuration

    2. Change Value under: NOEDID_864545_52RD2FGR2F_32FG22R_3ER3SE^43RSF4TGFGDG546F\00\00

       ActiveSize.cx (640)

       ActiveSize.cy (800)

    Change to

        ActiveSize.cx (1920)

       ActiveSize.cy (1200)

    So now what if we have 200 of these computers and different monitors, how do we go about generating a script to detect and change these values?

    Greatly appreciated!

    Thank you


    Tuan

    Monday, January 11, 2016 6:53 PM

Answers

  • Assuming solving the root issue is off the table, your request is twofold:

    1) How to attach a task to a wakeup event:

    • http://askubuntu.com/questions/226278/run-script-on-wakeup
    • http://superuser.com/questions/144441/automatically-run-a-script-or-a-program-on-wake-from-standby-in-windows-7
    • http://stackoverflow.com/questions/10362017/need-to-run-a-powershell-script-every-time-system-wakes-up-from-sleep

    2) How to set a registry key with PowerShell

    • http://blogs.technet.com/b/heyscriptingguy/archive/2012/05/09/use-powershell-to-easily-create-new-registry-keys.aspx

    A few other thoughs

    • A system GPO won't apply in a timely manner, so i wouldn't bother with that
    • be sure to set the execution policy on your client machines and/or sign your PowerShell script

    Mike Crowley | MVP
    My Blog -- Baseline Technologies

    Tuesday, January 12, 2016 1:55 AM

All replies