Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

Running .bat elevated user


  • Please log in to reply
5 replies to this topic

#1
joe43wv

joe43wv

    Member

  • Member
  • PipPip
  • 242 posts
  • Joined 08-May 08
  • OS:none specified
  • Country: Country Flag
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?


How to remove advertisement from MSFN

#2
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,536 posts
  • Joined 13-October 04
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

You need to provide more information.

#3
joe43wv

joe43wv

    Member

  • Member
  • PipPip
  • 242 posts
  • Joined 08-May 08
  • OS:none specified
  • Country: Country Flag
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.

#4
allen2

allen2

    Not really Newbie

  • Member
  • PipPipPipPipPipPipPip
  • 1,812 posts
  • Joined 13-January 06
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.

#5
joe43wv

joe43wv

    Member

  • Member
  • PipPip
  • 242 posts
  • Joined 08-May 08
  • OS:none specified
  • Country: Country Flag
Thanks allen2, the computers in question are all Windows XP devices. Is there a way for XP to do this?

#6
allen2

allen2

    Not really Newbie

  • Member
  • PipPipPipPipPipPipPip
  • 1,812 posts
  • Joined 13-January 06
Of course it will work for XP if you use the proper settings in the gpo (and in this case you don't need to add any line).




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN