Jump to content

Running .bat elevated user


joe43wv

Recommended Posts

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?

Link to comment
Share on other sites


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.

Link to comment
Share on other sites

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.

Link to comment
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.
×
×
  • Create New...