Settings using powershell/cmd?

Page 2 of 2 FirstFirst 12

  1. Posts : 668
    Win 10 pro
    Thread Starter
       #11

    Thanks for the info, I was also searching some documentation and I realize that probably a couple of scripts can't replace years of experience and insight of how windows works under the hood, there is no magic "document that explain everything".

    Thanks to @dalchina and @TairikuOkami for your help.
      My Computer


  2. Posts : 1,767
    Windows 10 Pro (+ Windows 10 Home VMs for testing)
       #12

    roy111 said:
    Thanks dalchina, but I'm looking for something different, I do not want, if possible, to use the settings interface, there are too much nested options and I can't remember where things are.
    I'll try to be more clear (hopefully)
    Lets say I want to turn on "night mode", instead of opening settings, and click on the switch, is it possible to give a powershell command to do that? Something like this totally fake command below
    Code:
    pwsettings -nightlight -option ON
    Yes, you could use PowerShell, a BAT/CMD file or other method (I use AutoHotkey 'cos I find the syntax easier than PowerShell plus I can create GUIs with toggles/options/buttons, etc.)

    As @dalchina mentions, the secret is finding the registry locations where the settings are amended. There are tools like Active Registry Monitor that will help but probably the simplest (and cheapest... it's free) is to use Sysinternals/TechNet's Process Monitor (ProcMon).

    Rather than reinvent the wheel, have a look at these tutorials/videos about using Process Monitor:


    Using your example of Win 10's Power light, the process (using ProcMon) would be:

    1. Start ProcMon.
    (Tip: Create a shortcut to Procmon.exe, set it to 'Run as administrator' and append -NoConnect to the target. This will start ProcMon as elevated and, more importantly, NOT monitoring.)
    Settings using powershell/cmd?-procmon-shortcut01.png

    2. Turn off monitoring for everything except the registry, i.e. on the toolbar leave just Show Registry Activity enabled:
    Settings using powershell/cmd?-procmon-show-registry-activity.png

    3. Add RegSetValue as a filter. (Perhaps easiest is to just download, unzip and import this filter: RegSetValue.zip.)

    4. Open Settings and navigate to System > Display.

    5. Amend window sizes so both the Settings and Procmon windows are visible/not overlapping:
    Settings using powershell/cmd?-procmon-night-light.png

    6. In ProcMon, click on the Capture button (or use CTRL+E).

    7. In Settings, click on the Night light toggle switch.

    8. Wait a second or two then, in ProcMon, click on the Capture button (or use CTRL+E) to stop capturing.

    9. Right-click on the captured RegSetValue results and choose Jump To... . This will open the Registry Editor at the keys you need to examine.

    (My test showed that the process invoked a change in two registry keys:
    Settings using powershell/cmd?-procmon-night-light1.png

    This is because toggling the Night light switch in Settings > System > Display also toggles a setting in Settings > System > Display > Night light settings.)

    Using this process you can build PowerShell, BAT/CMD, AHK scripts to implement the changes you want without even opening the Settings app.

    Hope this helps...
      My Computer


  3. Posts : 2,450
    Windows 10 Pro x64
       #13

    To set any Group Policy via the command line, instead of using the gpedit GUI, you can use the Microsoft Group Policy Settings Reference Spreadsheet.
    That is also a great Reference for people using the Home Edition of Windows 10, who don't have the Group Policy Editor option.

    Download Group Policy Settings Reference Spreadsheet Windows 1809 from Official Microsoft Download Center

    Download Group Policy Settings Reference Spreadsheet Windows 1803 from Official Microsoft Download Center
    Last edited by ddelo; 12 Jan 2019 at 19:04.
      My Computer


  4. Posts : 14,046
    Windows 11 Pro X64 22H2 22621.1848
       #14

    Also don't forget the majority of Brink's tutorials are based on registry changes so there is a lot that can be learned by looking at them too.
      My Computers


  5. Posts : 668
    Win 10 pro
    Thread Starter
       #15

    Thanks for your help everybody! Really some good ideas.
      My Computer


  6. Posts : 42,992
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #16

    Easy tool to find registry changes made: Regshot (free).

    Ensure your system is 'quiet' - little happening.
    Run Regshot, click 'Shot 1' ...wait
    Make your change.
    Click 'Shot 2' ...wait
    When ready, click Compare.
    You get an HTML page showing changes categorised by addition, deletion, change.
      My Computers


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 05:44.
Find Us




Windows 10 Forums