Link to home
Start Free TrialLog in
Avatar of joestramandinoli
joestramandinoliFlag for Australia

asked on

Setting a time server via batch file

Hi All,

I need to be able to set a time server via batch file.

I have made a small script

net time \\192.168.0.23 /set /yes

However, when I try to run this on one of our store computers, it says that the access is denied.

How do I get this to run with the admin username and password?

Any help will be much appreciated.

Thanks

Joe
Avatar of Reubenwelsh
Reubenwelsh

Hi, You have wto options really unless you want to go the ugly way of baking in admin passwords in items.

1. Run it as a scheduled task
2. Run it as a GPO (set a registry value)

See: http://support.microsoft.com/kb/223184



Avatar of Krzysztof Pytko
Does this machine is a part of domain environment? If so, you don't have to configure anything. Time services are issued to clients by PDC Emulatro master.
But if you wish to change anything with time services, you need to use for that w32tm command
More about this command at
http://technet.microsoft.com/en-us/library/cc773263%28WS.10%29.aspx#w2k3tr_times_tools_dyax

Regards,
Krzysztof
Ar ethe computers NOT on a windows Domain? Computers on the domain will automatically set time in sync with the domain contollers and in turn all DC's will sync with the DC that holds the PDC Emulator role.
just copy your command line into the logon script of users, never had problem doing that way unless your machine is not part of the domain.
Usually i use this syntax as first line of logon scripts :
net time \\ServerName /SET /Y

you need to run it as an Admin from an Admin enabled command prompt -- if i recall you can't set a batch file to force Run As Admin from the compatibility tab.

for a non-domain system, you will find the Time server tab under Date & Time (3rd tab which you can specify a server -- default is TIME.MICROSOFT.COM

domain systems will take the NTP setting from the DHCP scope - Server Option 042
Avatar of joestramandinoli

ASKER

Hi,

Thanks for all the replies....

Our stores are in a private wan but are not on the domain so they can't authenticate using domain credentials so this script needs to run as the local admin on the machines.

Thanks

Joe
Anyone?
net localgroup administrators "domain\security groups" /add
This will add a security group from your domain to the local admins group for the desktop.
ASKER CERTIFIED SOLUTION
Avatar of Daelt
Daelt

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks, I will give that a shot