Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 

joe43wv

Running .bat elevated user

Recommended Posts

joe43wv    0

I am working on a batch script to run in one of our GPO's but I need it to run as an elevated user so it will install on end user devices regardless of what user is logging in. Any thoughts?

Share this post


Link to post
Share on other sites
joe43wv    0

I have written a script to install a service. To do this it requires administrative privileges. Not all of our users on the network have administrative rights to their desktop. I would like for this batch script to be ran as a different user other than the user logging in to ensure it has the correct access to install the service.

Share this post


Link to post
Share on other sites
allen2    1

It seems you're miss-using the gpo.

When your target is the computer and in this case it is or it will be as whatever the way you'll use to install the service it will be installed on the computer and for every user using that computer (even if you targeted only one user at first).

Then you have two kind of scripts that might running from gpo: computer startup/shutdown scripts and user logon scripts.

As you're deploying something related to the computer, you'll need to use the computer startup script (unless you prefer using shutdown script). With computer startup scrip, your script will run with the targeted computer system account (so it might not have access to some shares if you didn't set rights properly there). Then if you're targeting computer with UAC enabled, you'll need to add the line:

set __COMPAT_LAYER=RunAsInvoker 

at the beginning of your batch script.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.

×