Solved

Setting a time server via batch file

Posted on 2011-09-26
10
1,191 Views
Last Modified: 2012-05-12
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
0
Comment
Question by:joestramandinoli
10 Comments
 
LVL 6

Expert Comment

by:Reubenwelsh
ID: 36597510
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



0
 
LVL 39

Expert Comment

by:Krzysztof Pytko
ID: 36597516
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
0
 
LVL 37

Expert Comment

by:Neil Russell
ID: 36597526
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.
0
 
LVL 4

Expert Comment

by:Daelt
ID: 36597722
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

0
 
LVL 20

Expert Comment

by:Iain MacMillan
ID: 36598555
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
0
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 

Author Comment

by:joestramandinoli
ID: 36598725
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
0
 

Author Comment

by:joestramandinoli
ID: 36813063
Anyone?
0
 
LVL 8

Expert Comment

by:PeteEngineer
ID: 36813137
net localgroup administrators "domain\security groups" /add
This will add a security group from your domain to the local admins group for the desktop.
0
 
LVL 4

Accepted Solution

by:
Daelt earned 500 total points
ID: 36813298
sometimes things are much easier and we "informaticians" like to make complicated things for not much.

Want to run your script as local admin?

Just set up a schedule task, in first tab, setup the local admin account, in the trigger tab (2nd tab), click new (at bottom) then select "at start up" in the menu. 3rd tab (Action), select "start a program" then browse to your script and select it. Click ok

Now your script will run with local admin rights each time you start up the machine.
0
 

Author Comment

by:joestramandinoli
ID: 36928874
Thanks, I will give that a shot
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
OfficeMate Freezes on login or does not load after login credentials are input.
This Micro Tutorial will teach you the basics of configuring your computer to improve its speed. It will also teach you how to disable programs that are running in the background simultaneously. This will be demonstrated using Windows 7 operating…
This Micro Tutorial will teach you how to the overview of Microsoft Security Essentials. This is a free anti-virus software that guards your PC against viruses, spyware, worms, and other malicious software. This will be demonstrated using Windows…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now