Using Python's subprocess to change ntp server settings in Windows -


so i'm trying change ntp server settings in windows (xp , 7) using following:

import subprocess subprocess.call(['net', 'stop', 'w32time']) subprocess.call(['reg', 'add','hklm\software\microsoft\windows\currentversion\datetime\servers', '/f /v \"0\" /t reg_sz /d \"ntp.craven.k12.nc.us\"']) subprocess.call(['reg', 'add', 'hklm\software\microsoft\windows\currentversion\datetime\servers', '/f /v \"(default)\" /t reg_sz /d \"0\"']) subprocess.call(['net', 'start', 'w32time']) subprocess.call(['w32tm', '/resync']) 

but fails miserably. i'm sure problem lies in how i'm formatting parameters, have yet come upon how properly.

your last arguments not splitted. need replace '/f /v \"0\" /t reg_sz ...' ] + ['/f', '/v', '0', '/t', 'reg_sz'] + [...].

as alternative, pass whole command string (as on command line).


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -