Sign in to follow this  
Followers 0
wesb

stepping back #requireadmin back to user

5 posts in this topic

I have been looking all through the forum and I havent been able to find anything on how to elevate a portion of a script or just a function with admin rights to work around the UAC and then get back to running the script as or with user rights. is there a switch to turn on #requireadmin and then turn it back off midway through a script? I thought about using RunAs but that wont work without passwords...i find that if I use RequireAdmin in script 1 and then call script 2 from script 1, 2 launches automatically as Admin and instead I need it to run as end user.

thanks,

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I'm not sure at all but you could try running a loop with #RequireAdmin and when you're done exit the loop and start another one with your current script so it might delete the administrative rights ? Posted Image

Edited by Jayson

Share this post


Link to post
Share on other sites

I'm not sure at all but you could try running a loop with #RequireAdmin and when you're done exit the loop and start another one with your current script so it might delete the administrative rights ? Posted Image

Thanks Jayson...i have tried calling another script that calls another script that calls the mail script and still get the same error. Once i remove the #requireAdmin from the first script...all works fine except that my application doesnt have the rights needed to perform all the necessary functions of remediation....grrrrrr

Share this post


Link to post
Share on other sites

hi wesb,

Try the other way around, have a script with no admin permissions call (and communicate with) one with #RequireAdmin at the top.

However, don't create a bunch of scripts with #RequireAdmin (to do each little task), so that the user gets bogged down with requests, perhaps just two scripts, one without permissions and one with, communicate between the two () and voila :unsure:

Hope this helps :>

-smartee

Share this post


Link to post
Share on other sites

hi wesb,

Try the other way around, have a script with no admin permissions call (and communicate with) one with #RequireAdmin at the top.

However, don't create a bunch of scripts with #RequireAdmin (to do each little task), so that the user gets bogged down with requests, perhaps just two scripts, one without permissions and one with, communicate between the two () and voila :unsure:

Hope this helps :>

-smartee

Smartee...way to think outside the box!! All I had to do was use script B to call script A with a RunWait then continue to run script B and get the info posted to the ini...Thanks a bunch...way to end the work week!!

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
Sign in to follow this  
Followers 0