How to run Batch script as Local administrator ?

People,

I have created Batch script to downgrade MS Visio but somehow it is not runnable through GPO Startup script due to the Run As ADministrator feature ?

when I ask the user to manually right click and Run As Administrator yes it works, but not through GPO.

So what additional line do I need to add ?

Thanks.
LVL 9
Senior IT System EngineerIT ProfessionalAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Paul MacDonaldDirector, Information SystemsCommented:
Use the "RUNAS" command.  Have your GPO call a batch that in turn calls the working batch using RUNAS to elevate the account doing the calling.
1
Senior IT System EngineerIT ProfessionalAuthor Commented:
ok, so in this case there is another batch file to call my main batch file script with the content:

runas downgrade-visio.bat

Open in new window


is that all ?
0
Paul MacDonaldDirector, Information SystemsCommented:
Yes, exactly.
0
Top Threats of Q1 & How to Defend Against Them

WEBINAR: Join WatchGuard CTO and our Threat Research Team on Aug. 2nd to hear the findings from our Q1 Internet Security Report! Learn more about the top threats detected in the first quarter and how you can defend your business against them!

FOXActive Directory/Exchange EngineerCommented:
There is no user set to run in the above command, it should read as
 
runas /user:domain\adminusername downgrade-visio.bat  or
runas /user:localmachinename\adminusername downgrade-visio.bat
1
Senior IT System EngineerIT ProfessionalAuthor Commented:
ok, so does this thing should works or is it just my local environment that is behaving erratically:

runas /user:.\adminusername downgrade-visio.bat

Open in new window

or
runas /user:%COMPUTERNAME%\adminusername downgrade-visio.bat

Open in new window

0
FOXActive Directory/Exchange EngineerCommented:
the 2nd one with the computername should work for you
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.