Solved

Setting a time server via batch file

Posted on 2011-09-26
10
1,242 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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
 

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

786 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