• Announcements

    • xper

      MSFN Sponsorship and AdBlockers!   07/10/2016

      Dear members, MSFN is made available via subscriptions, donations and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, become a site sponsor and ads will be disabled automatically and by subscribing you get other sponsor benefits.
joe43wv

Running .bat elevated user

6 posts in this topic

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?

0

Share this post


Link to post
Share on other sites

You need to provide more information.

0

Share this post


Link to post
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.

0

Share this post


Link to post
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.

0

Share this post


Link to post
Share on other sites

Thanks allen2, the computers in question are all Windows XP devices. Is there a way for XP to do this?

0

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.