Spare one cmd file from UAC
OK, so I am back in a situation where I am pulling my hairs out .... and once again the reason is UAC. I have to execute a cmd file in a schedule automatically. the scheduler is a 3rd party scheduler In order to run this cmd file manually, I need to right click on the cmd file and say "run as administarator" and it runs fine. If I just double click it ... it nicely gives an error "you need to run the foo.exe with administrative privileges" Now when the legacy scheduler runs the cmd file I can see in the log ... the error message "you need to run foo.exe with administrative privileges" Now unlike windows task scheduler the legacy scheduler does not have a checkbox called "run with highest privileges" I really need to execute this cmd file and want it to execute always with administrative permissions. I googled and found some registry hacks like http://www.verboon.info/index.php/2011/03/running-an-application-as-administrator-or-in-compatibility-mode/ but it does not work in my environment Here are the contents of my cmd file C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -File c:\Autosysjobs\SharePoint_Backup_prep.ps1 Here is the content of the powershell file & "c:\program files\microsoft data protection manager\dpm\bin\dpmbackup.exe" -db $x = $LASTEXITCODE & "c:\program files\microsoft data protection manager\dpm\bin\dpmbackup.exe" -replicas $y = $LASTEXITCODE if ($x -eq 0 -and $y -eq 0) { exit 0 } else { exit 1 } Here is a set of keys in my registry Can someone please please tell me how can I always run my cmd file always in run as admin mode. Please!!!! MSDNStudent Knows not much!
February 3rd, 2012 5:53am

Please see if following helps in your case... RUNAS + PASSWORD + ENCRYPTION = RUNASSPC (Windows Vista, XP, 2000, 2003, Server 2008, Windows 7) http://www.robotronic.de/runasspcEn.htmlVote As Helpful, if you find my information useful ! This posting is provided "AS IS" with no warranties or guarantees and confers no rights.
Free Windows Admin Tool Kit Click here and download it now
February 3rd, 2012 9:12am

Please see if following helps in your case... RUNAS + PASSWORD + ENCRYPTION = RUNASSPC (Windows Vista, XP, 2000, 2003, Server 2008, Windows 7) http://www.robotronic.de/runasspcEn.htmlVote As Helpful, if you find my information useful ! This posting is provided "AS IS" with no warranties or guarantees and confers no rights.
February 3rd, 2012 9:15am

> RUNAS + PASSWORD + ENCRYPTION = RUNASSPC Sorry! This is not clear to me. So when I create the string value in registry under HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers Should the value be RUNASSPC instead of WINXPSP3 RUNASADMIN?MSDNStudent Knows not much!
Free Windows Admin Tool Kit Click here and download it now
February 3rd, 2012 8:11pm

> RUNAS + PASSWORD + ENCRYPTION = RUNASSPC Sorry! This is not clear to me. So when I create the string value in registry under HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers Should the value be RUNASSPC instead of WINXPSP3 RUNASADMIN?MSDNStudent Knows not much!
February 3rd, 2012 8:14pm

Please refer the Guidance RunasSpc http://www.robotronic.de/guidance.htmlVote As Helpful, if you find my information useful ! This posting is provided "AS IS" with no warranties or guarantees and confers no rights.
Free Windows Admin Tool Kit Click here and download it now
February 3rd, 2012 9:33pm

Please refer the Guidance RunasSpc http://www.robotronic.de/guidance.htmlVote As Helpful, if you find my information useful ! This posting is provided "AS IS" with no warranties or guarantees and confers no rights.
February 3rd, 2012 9:36pm

this will not work for me because this utility requires you to type in username and password. this is not allowed/possible in my environment. I need a utility which takes in the credentials of the current user. should not require to explicitly type in the password.MSDNStudent Knows not much!
Free Windows Admin Tool Kit Click here and download it now
February 4th, 2012 2:50am

this will not work for me because this utility requires you to type in username and password. this is not allowed/possible in my environment. I need a utility which takes in the credentials of the current user. should not require to explicitly type in the password.MSDNStudent Knows not much!
February 4th, 2012 2:53am

If you are indeed using AutoSys as indicated by the path referenced in your original article, you might want to check in with the vendor, Computer Associates. Particularly as AutoSys is rather old now. The support matrix for the latest version of CA Workload Automation indicates it support Server 2008 R2 (notably not R2 SP1), so there may well be either an upgrade you might need to look at or even something less drastic like a configuration change you can make to allow this to work natively. Cheers, Lain
Free Windows Admin Tool Kit Click here and download it now
February 4th, 2012 4:41am

If you are indeed using AutoSys as indicated by the path referenced in your original article, you might want to check in with the vendor, Computer Associates. Particularly as AutoSys is rather old now. The support matrix for the latest version of CA Workload Automation indicates it support Server 2008 R2 (notably not R2 SP1), so there may well be either an upgrade you might need to look at or even something less drastic like a configuration change you can make to allow this to work natively. Cheers, Lain
February 4th, 2012 4:44am

Hello, Please check if this article helps. Ignore UAC for specific programs http://msmvps.com/blogs/martinzugec/archive/2008/05/16/ignore-uac-for-specific-programs.aspx Thanks ZHANG
Free Windows Admin Tool Kit Click here and download it now
February 6th, 2012 1:30am

this is exactly what I have done for now. The autosys executes a cmd file which executes a windows task which executes my powershell script which executes the DPMBackup.exe works!!! but very roundabout way of achieving something simple....MSDNStudent Knows not much!
February 6th, 2012 2:39am

Hello, Please check if this article helps. Ignore UAC for specific programs http://msmvps.com/blogs/martinzugec/archive/2008/05/16/ignore-uac-for-specific-programs.aspx Thanks ZHANG
Free Windows Admin Tool Kit Click here and download it now
February 6th, 2012 9:27am

this is exactly what I have done for now. The autosys executes a cmd file which executes a windows task which executes my powershell script which executes the DPMBackup.exe works!!! but very roundabout way of achieving something simple....MSDNStudent Knows not much!
February 6th, 2012 10:35am

When I opened a reply to my problem similar to this, the side links directed to a number queries and answers. as old as 2003 with other versions of MS Windows, and to this. It seems that a lot of people have had similar propblems and a lot of solutions have been provided, but none seems to work satisfactory for everyone. All require complicated set up of scripts to overcome the restrictions of UAC, solutions which create another set of vulnerabilities. Or, the standbys - to always login as admin, and to set UAC not to ask you any questions; both of which will put you to major levels of risks. Now, I don't know if the MS Windows developers are knowlegeable of other operating systems. You see, others must have had similar problems and provided ways around it. For example, in Unix/Linus, root (admin) may set a "Sticky bit" permission on a file which has high priviledges and then an ordinary user may perform the functions that may otherwise require admin permissions. Otherwise, an ordinary user, without the applicable permissions to a file, cannot run/execute the file, let alone usurp admin authority. I would suggest the developers think of such a solution. Cheers.
Free Windows Admin Tool Kit Click here and download it now
August 5th, 2012 8:24pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics