Solved

Setting a time server via batch file

Posted on 2011-09-26
10
1,484 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

 
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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
For anyone that has accidentally used newSID with Server 2008 R2 (like I did) and hasn't been able to get the server running again because you were unlucky (as I was) and had no backups - I was able to get things working by doing a Registry Hive rec…
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…
This Micro Tutorial will give you basic overview of the control panel section on Windows 7. It will depth in Network and Internet, Hardware and Sound, etc. This will be demonstrated using Windows 7 operating system.

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