wesb Posted May 4, 2011 Share Posted May 4, 2011 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, Link to comment Share on other sites More sharing options...
Jayson Posted May 5, 2011 Share Posted May 5, 2011 (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 ? Edited May 5, 2011 by Jayson Link to comment Share on other sites More sharing options...
wesb Posted May 6, 2011 Author Share Posted May 6, 2011 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 ? 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 Link to comment Share on other sites More sharing options...
smartee Posted May 6, 2011 Share Posted May 6, 2011 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 Hope this helps -smartee Link to comment Share on other sites More sharing options...
wesb Posted May 6, 2011 Author Share Posted May 6, 2011 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 Hope this helps -smarteeSmartee...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!! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now