Using cmd to edit reg keys?

0

I need to edit 2 registry keys in Windows 8.1 but make it in a way to be able to use them in a batch file to be able to use them on more than 1 PC. In the batch file I will have more reg key's that will also make few other changes; but the 2 keys that i need to change are:

  1. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient

in here I need to change the value of the "SpecialPollInterval" key from the default to 3600.

  1. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient

in here I need to change the value of the "SpecialPollTimeRemaining" key to my NTP server.

Or need some other way to change the default ntp server from cmd and resync it in Win 8.1, that can be added to a batch file.

How I've tried to edit the above keys is like this:

  1. reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Service\W32Time\TimeProviders\NtpClient /v SpecialPollInterval /t REG_DWORD /d 3600 /f

  2. reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Service\W32Time\TimeProviders\NtpClient /v SpecialPollTimeRemaining /t REG_MULTI_SZ /d ntp.server,7c30bcf /f

They complete succesfully but no changes are made, the keys are not created nor edited

Need to add those 2 in the batch file I have made (code so far):

@echo on
bcdedit /set recoveryenabled no
tzutil /s  "GTB Standard Time"
reg add HKLM\Software\BrowserChoice /v Enable /t REG_DWORD /d 0 /f
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 1 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fAllowToGetHelp /t REG_DWORD /d 1 /f

Fate Averruncus

Posted 2014-12-08T19:17:08.450

Reputation: 42

Question was closed 2016-04-20T12:23:17.490

AFAICT, what you're doing there should add or modify the keys. When you run the batch file are you running it "As Administrator"? – Ƭᴇcʜιᴇ007 – 2014-12-08T19:29:49.560

2Missing closing quotation mark "HKLM\...\NtpClient /v should be "HKLM\...\NtpClient" /v in 1 and 2 reg add – JosefZ – 2014-12-08T19:42:12.367

Closing due to it being a typo – random – 2016-04-20T12:23:17.490

Answers

1

You will need to make sure to run as administrator, otherwise you will not actually have the permissions required to modify the registry.

If you're running the commands manually from a command prompt with elevated permissions you'll notice the commands worked fine but once you try to click on the batch files from windows explorer or automate them (without giving admin rights) it will only run the commands as a standard user.

nvuono

Posted 2014-12-08T19:17:08.450

Reputation: 734

1

Got it done seems the problem was a mistyped word.... no wonder it did not work missed a letter from a word lol

Fate Averruncus

Posted 2014-12-08T19:17:08.450

Reputation: 42