Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have Public machines that I need to run log-off scripts, which are in Perl. I want the script to run for a Standard user. It seems that the UAC is blocking this from happening. So, I have turned the UAC level to "never notify" which seems to be turning UAC off. But, still no dice. These scripts have to be ran at log-off!

share|improve this question
    
If you run this script while logged in as a non-admin user, does UAC prompt for elevation? Also, how are you running this script? Through group policy –  uSlackr Jun 16 '11 at 19:45
    
@uSlacker- Yes I'm running this through GPO as a log-off script –  chrsblck Jun 17 '11 at 16:23
    
UAC is not turned off if you set it to never notify. There's another method that you need to use to disable it completely. –  user3463 Jun 17 '11 at 16:33
    
@Randolph- As per the Microsoft Tech Net page this is the fix they give to "turn UAC off". If I'm not turning UAC off, do you know how? –  chrsblck Jun 17 '11 at 16:45
    
I appear to have been thinking of Windows Vista, not Windows 7. I apologise for the confusion. Vista has an explicit "turn off" option to click on. –  user3463 Jun 17 '11 at 16:50

2 Answers 2

From your description it seems the script requires admin privileges to execute. Unless the script is launched from a process that has an admin token you will be prompted through UAC to elevate your privileges.

You can circumvent this limitation with a simple Windows service that runs as the LOCAL SYSTEM user and implements the OnCustomCommand() method.

From the logoff script have an executable that calls the ExecuteCommand() method passing a predetermined int which will act as a trigger for the service to perform the commands that require admin privileges.

private enum CustomCommands { RunAsAdmin = 128 };
ServiceController srvc = new ServiceController("SimpleService");
srvc.ExecuteCommand((int)CustomCommands.RunAsAdmin);

ServiceBase.OnCustomCommand Method

share|improve this answer
    
@bzsparks- So I need to create a VB file that will call my Perl script? I tried this idea with a Batch file that will run an executable as Admin, but no luck. So, I've never written anything VB, can you help here? –  chrsblck Jun 17 '11 at 17:58

UAC will block programs which need admin access.

If your perl scripts is asking for elevation, then for a standard user, even if UAC is off, Windows will ask for admin access (Behaviour similar to Windows XP).

What does the logoff script do? If it needs to run something that needs admin privilege, then you may need to write a scheduled task or a Windows Service that runs in Admin account to do that for you.

share|improve this answer
    
The Perl script does a few things. It clears all TIF's, saves a few Dir's for the user, and runs some system calls to remove form data, etc... I also tried writing a batch file to elevate the Perl script, but the .bat will not run either. With XP, my method worked fine –  chrsblck Jun 16 '11 at 19:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.