How to run Batch script as Local administrator ?


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 ?

LVL 11
Senior IT System EngineerIT ProfessionalAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.
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 ?
Paul MacDonaldDirector, Information SystemsCommented:
Yes, exactly.
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

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

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

Open in new window

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

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.