Settings using powershell/cmd? Solved

Page 2 of 2 FirstFirst 12

  1. Posts : 553
    Ubuntu 18.04, Windows 10 pro 18.09, win 8.1 pro
    Thread Starter
       30 Dec 2018 #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 ComputerSystem Spec

  2.    12 Jan 2019 #12

    roy111 said: View Post
    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.)
    Click image for larger version. 

Name:	procmon-shortcut01.png 
Views:	28 
Size:	4.7 KB 
ID:	220758

    2. Turn off monitoring for everything except the registry, i.e. on the toolbar leave just Show Registry Activity enabled:
    Click image for larger version. 

Name:	procmon-show registry activity.png 
Views:	28 
Size:	8.0 KB 
ID:	220759

    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:
    Click image for larger version. 

Name:	procmon-night-light.png 
Views:	29 
Size:	107.0 KB 
ID:	220761

    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:
    Click image for larger version. 

Name:	procmon-night-light1.png 
Views:	28 
Size:	17.3 KB 
ID:	220763

    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 ComputerSystem Spec

  3.    12 Jan 2019 #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 ComputerSystem Spec

  4. Ztruker's Avatar
    Posts : 7,247
    Windows 10 Pro X64 1809 17763.292
       12 Jan 2019 #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 ComputersSystem Spec


  5. Posts : 553
    Ubuntu 18.04, Windows 10 pro 18.09, win 8.1 pro
    Thread Starter
       13 Jan 2019 #15

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

  6.    13 Jan 2019 #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 ComputersSystem Spec


 
Page 2 of 2 FirstFirst 12

Related Threads
Good Morning everyone I'm currently working on a WDS and I would like to automate as much as possible. I created a customize Userprofile (sysprep it and saved it on WDS-Server) thanks to a Tutorial on this Website and many of the changes I made...
cmd vs powershell in General Support
Greetings. As a normal PC-geek I don't know how, when and why I should use Powershell instead of cmd. Or in another way, why has Microsoft changed cmd to Powershell in the right-click menu? What are the benefits? Or has Microsoft just done this...
Solved PowerShell in Performance & Maintenance
I have a 64-bit laptop running Win 10 Home. I just notice in All apps, there is an entry of PowerShell and PowerShell (x86). I realize the former is for 64-bit and the latter is for 32-bit. Question : In my 64-bit laptop, when I open...
I just set up Family Accounts in Windows 10, and we've had the PC for about 2 months already. I set one up for my son, but I'm mostly concerned he's spending too much time on the computer and want to set time limits. Once he had his own account,...
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 00:54.
Find Us