Run a batch script to run as administrator on startup

2

0

Each and every time on startup my computer is showing wrong time. So I started using w32tm /resync /force command to synchronise time from internet. I have configured my system to run this cmd script on startup. But running this script with administrator privileges only could update the time. Please help me to run a batch script to run as administrator on startup.

I also tried making a shortcut to batch, set its properties>advanced to run as administrator and then move the shortcut to the startup directory.But I couldn't bypass the prompt.

Nevin Raj

Posted 2017-08-14T18:11:14.403

Reputation: 131

1in the task scheduler, check the box on the General tab that says "run task with highest privledge". this will make it run as admin. Also, on the Conditions tab, check "start only if the following network connection is available", and select "Any Connection". this will ensure that you can sync when the task is run. – Frank Thomas – 2017-08-14T18:23:06.230

So when you say "I have configured my system to run this cmd script on startup" does this mean you are putting a script in the /Startup folder or are you running as a scheduled task? – Pimp Juice IT – 2017-08-14T18:23:22.030

1

In addition to what Frank said, the trigger of Task Scheduler could be At Startup and from the General tab you can also select the box labeled Run whether user is logged on or not. Have a look at https://superuser.com/questions/1005192/problems-scheduling-a-task-on-windows7/1005216#1005216

– Pimp Juice IT – 2017-08-14T18:26:37.420

@McDonald's I used shell:startup command in run and pasted the script there – Nevin Raj – 2017-08-15T05:55:59.987

So rather than having it run from the shell:startup location, schedule it to run from Task Scheduler instead & be sure to use the options for the task as my answer shows in the link of my above comment in the Task Scheduler Properties section. Just create C:\Scripts & put it there instead & point the job to it. From the Triggers tab of the job, have it run At Logon from the drop down. See screen shot here for example: https://i.imgur.com/icI0n4P.png but read over the Task Scheduler Properties from the link on my answer in the above comment I left too. Let me know how it goes.

– Pimp Juice IT – 2017-08-15T11:46:54.643

Nevin - What did you ever determine with this? Did you see may suggestion and try it or use another suggestion per one of the other answers or what? – Pimp Juice IT – 2018-03-09T23:10:00.127

Answers

0

If you don't mind converting your script, use F2KO Software's Bat To Exe Converter (Freeware). Under the Miscellanieous box, check Add administrator manifest before converting the script. Then place a shortcut to the executable in %STARTUP%.

Mr. Mendelli

Posted 2017-08-14T18:11:14.403

Reputation: 1 061

-2

Not sure of your expertise and not to sound rude, but I'd like to point out that if your PC is not keeping the correct time on startup, you may have a problem with your CMOS Battery. The OS will look to the CMOS for basic info like this on every boot.

I'm guessing that your BIOS settings were left as default as well when you got it. This is because if you've made changes to BIOS settings, they too would be wiped on every boot, because the CMOS can't hold the info without a battery.

If the problem doesn't lay with the battery, I'd even go so far to say you could have some malware issues. I've seen that a few times before as well.

Good Luck!

Bryce Reynolds

Posted 2017-08-14T18:11:14.403

Reputation: 1