LVCVA Posted March 18, 2008 Share Posted March 18, 2008 Hello, I don't know if this is possible but I would like to be able to give our users who are not local Admins the ability to run Windows Defrag. We are running Windows Vista and per company policy this includes having UAC turned on. Here is what I am trying: CODE; Run Windows Defrag as an Administrator ; Needed to run this script on Windows Vista with UAC on #RequireAdmin ; Run as local Administrator If Not isAdmin() then $pwd = "password" RunAsSet("administrator",@ComputerName,$pwd) endIf RunWait("c:\windows\system32\dfrgui.exe") But when this runs as a standard user, they are still prompted for admin credentials. Is there a way to get around this? Link to comment Share on other sites More sharing options...
Yorn Posted March 18, 2008 Share Posted March 18, 2008 You can't run in the context of another user and display the GUI to a different user in Vista (as far as I know). PSEXEC lets you do this on XP, but I don't think there's a way to do this on Vista yet (or ever, considering you're running UAC). Link to comment Share on other sites More sharing options...
LVCVA Posted March 19, 2008 Author Share Posted March 19, 2008 You can't run in the context of another user and display the GUI to a different user in Vista (as far as I know). PSEXEC lets you do this on XP, but I don't think there's a way to do this on Vista yet (or ever, considering you're running UAC).I suspected as much, but thank you for your reply. Link to comment Share on other sites More sharing options...
MHz Posted March 19, 2008 Share Posted March 19, 2008 But when this runs as a standard user, they are still prompted for admin credentials. Is there a way to get around this?Either you choose to use #RequireAdmin or use RunAsSet(), but not both within the same instance of execution. Others have reported that using both fails. If you want to have a prompt, then use #RequireAdmin. If you want no prompt, then use RunAsSet(). AFAIK, IsAdmin() may not work as expected with UAC on and further testing may prove that. 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