?
Solved

Setting a time server via batch file

Posted on 2011-09-26
10
Medium Priority
?
1,567 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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
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 2000 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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Suggested Courses

801 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