Windows 10: Bypass UAC in Windows 10 to run a backup job using batch file.

Discus and support Bypass UAC in Windows 10 to run a backup job using batch file. in Windows 10 Backup and Restore to solve the problem; Hi Everyone, This is my first posting on this forum, so please bear with me if I may have inadvertently not followed all the rules although I did... Discussion in 'Windows 10 Backup and Restore' started by agarwaldvk, Jan 2, 2016.

  1. Bypass UAC in Windows 10 to run a backup job using batch file.


    Hi Everyone,


    This is my first posting on this forum, so please bear with me if I may have inadvertently not followed all the rules although I did try.

    I have a need to run a backup job at logoff/shutdown using the Genie Backup Software. The code in the batch file to do so is shown here (Exactly as it appears in the batch file - the batch file is named "DeepakPC_Backup_GBM_Command.bat") :-

    The following command can only be run on my main PC that runs on Windows 10 Professional 64 bit O/S with the Genie Backup Software.

    Starts Here
    "D:\Program Files\Genie9\Genie Backup Manager\GBM.exe" -e -job "DeepakPCBackup"
    Ends Here

    As a FYI, this command runs fine once the UAC dialog box is provided with the appropriate response when run at Command Prompt or by double clicking on the batch file. I do not wish for this UAC dialog box to appear and would want to run the application by passing the UAC dialog box.

    The above batch file is not run directly but is called by a VB Script fie (a .vbs file named "DeepakPC_Backup_UserInteractionScript.vbs"), the contents of which are as follows :-

    Code: Dim objShell, strComputer, strInput Const wshYes = 6 Const wshNo = 7 Const wshYesNoDialog = 4 Const wshQuestionMark = 32 Set objShell = CreateObject("Wscript.Shell") intReturn = objShell.Popup("Do you want run the backup job now?", 0, "Backup Now?", wshYesNoDialog + wshQuestionMark) If intReturn = wshYes Then objShell.Run "%comspec% /c ""E:\DataFiles\Deepak\GBMBackupProcessFiles\DeepakPC_Backup_GBM_Command.bat""",1 , True set objShell = Nothing End If [/quote] Ordinarily, the above VB script is run as a 'Shutdown script' specified in the Group Policy Editor.

    With the above set up, the process still works but I do get the UAC dialog box - this is something that is not acceptable to me and I wanted to be able to run this process without the UAC dialog box showing up.

    I did a lot of googling and learned that this would require a registry change with when effected using a batch file would normally require a reboot - again something that is not acceptable in this current circumstances. I eventually came up with some code (with bits of code from other people on the internet with some part of it coming from Shawn Brink - the bit for creating 4 different .reg files for the different levels of UAC that were generally acceptable in one of his postings) to change the registry entries - which requires running the Command Prompt as an 'Administrator'.

    The following command can only be run on another PC that runs on Windows 7 Professional 64 bit O/S but doesn't have the Genie Backup Software, so I can only test for registry entries change on this PC.

    This code is shown below :-

    Code: Set oShell = CreateObject("Shell.Application") 'This supposedly runs the Command Prompt as an Administrator oShell.ShellExecute "cmd.exe", "/k", , runas, 1 Set objShell = CreateObject("Wscript.Shell") objShell.Run "%comspec% /c ""E:\DataFiles\GBMBackupProcessFiles\ChangeUAC_RegFiles_Modified.bat""", 1, True [/quote]

    This code in the ChangeUAC_RegFiles_Modified.bat is shown below :-

    Code: 'This is where the registry files reside on my test PC cd /d e:\DataFiles\UACModifiedRegistryFiles\ Start regedit.exe /S UAC_Level-4_Disable.reg [/quote] This code in the UAC_Level-4_Disable.reg is shown below :-
    Code:
    Windows Registry Editor Version 5.00
    ; Created by: Original script by Shawn Brink, modified by Deepak Agarwal on 26/12/2015
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
    "ConsentPromptBehaviorAdmin"=dword:00000000
    "EnableLUA"=dword:00000000
    "PromptOnSecureDesktop"=dword:00000000
    This seems to run OK on this PC. Assuming that this will work on my PC running Windows 10 Professional 64 bit O/S, the the full VB script shutdown script will look like this :-

    Code: Dim objShell, strComputer, strInput Const wshYes = 6 Const wshNo = 7 Const wshYesNoDialog = 4 Const wshQuestionMark = 32 Set objShell = CreateObject("Wscript.Shell") intReturn = objShell.Popup("Do you want run the backup job now?", 0, "Backup Now?", wshYesNoDialog + wshQuestionMark) If intReturn = wshYes Then Set oShell = CreateObject("Shell.Application") 'Run the Command Prompt as an Administrator oShell.ShellExecute "cmd.exe", "/k", , runas, 1 Set objShell = CreateObject("Wscript.Shell") 'Run the batch file to make the necessary registry entry changes to avoid the UAC dialog box objShell.Run "%comspec% /c ""E:\DataFiles\GBMBackupProcessFiles\ChangeUAC_RegFiles_Modified.bat""", 1, True 'Run the batch file to run the backup job objShell.Run "%comspec% /c ""E:\DataFiles\Deepak\GBMBackupProcessFiles\DeepakPC_Backup_GBM_Command.bat""",1 , True 'May not be necessary set objShell = Nothing End If [/quote]
    I would be grateful if someone could please have a look at above piece of code and advise if this philosophy will on a PC running Windows 10 Professional 64 bit O/S as well as I did read somewhere though that this philosophy will work only with PC's running up to Windows 8 or 8.1.? I cannot test the whole thing on my test PC as only runs Windows 7 Professional 64 bit O/S and also doesn't have Genie Backup Software on it either. Also, that I am a trifle uncomfortalble running code that tampers with registry entries on my main PC with a lot to loose before someone of the likes of you all at least having a look at the test code provided above.


    Any assistance shall be highly values.


    Best regards


    Deepak

    :)
     
    agarwaldvk, Jan 2, 2016
    #1
  2. fpefpe Win User

    uac query

    Hello -- I have a batch file that runs a program that query the UAC and will prompt me every time I run -- It a safe program -- is there a way to set

    up a "white list" so UAC will not prompt for confirmation?
     
    fpefpe, Jan 2, 2016
    #2
  3. Tryx3 Win User
    UAC prompt from batch runas administrator

    If you can change to running the batch file from a shortcut instead of the command line then you could solve the problem by setting that shortcut to requiring Admin [right-click on the shortcut, Properties, Advanced, Run as Admin]. The desired standard
    UAC prompt will then appear whenever the shortcut runs.

    If you start the batch file from Task scheduler then that can be made to co-operate with you. It normally refuses to run shortcuts but you can work around the limitation - see

    Use Windows 7 Task scheduler to run a batch file minimised and with a specific icon
     
    Tryx3, Jan 2, 2016
    #3
Thema:

Bypass UAC in Windows 10 to run a backup job using batch file.

Loading...
  1. Bypass UAC in Windows 10 to run a backup job using batch file. - Similar Threads - Bypass UAC run

  2. Cant run Batch file

    in Windows 10 Gaming
    Cant run Batch file: When i try to run a batch file all it says is this app can't run on your pc i tried going to my property and going to compatibility but it isn't there im on windows 11 btw but if someone can pls help...
  3. Cant run Batch file

    in Windows 10 Software and Apps
    Cant run Batch file: When i try to run a batch file all it says is this app can't run on your pc i tried going to my property and going to compatibility but it isn't there im on windows 11 btw but if someone can pls help...
  4. Access denied for every batch job

    in Windows 10 BSOD Crashes and Debugging
    Access denied for every batch job: Even if the batch job only contains an echo hello and a pause. Of course if I run it as administrator it works, but for some of my apps this option is not available. None of my IDEs work, Arduino, Eclipse, or VScode. In particular, with VScode, the batch file in question is...
  5. Bypass UAC Prompt for Excel

    in AntiVirus, Firewalls and System Security
    Bypass UAC Prompt for Excel: Whenever I open Excel often I get the UAC verification prompt. So of course I have to click Yes to proceed. Word and PowerPoint donot raise the UAC prompt. I perceive Excel, as part of Microsoft Office, to be just as trusted as Word and PowerPoint. So why the UAC prompt only...
  6. make a group bypass uac

    in Windows 10 Customization
    make a group bypass uac: is there a way to make a group that gives administrator perms by default, like the hidden built in administrator account, but with a group? all of the users in the group will have administrator access, but uac will be disabled for the administrators in the group. is this...
  7. Got Hit By A Torjan With UAC Bypass

    in AntiVirus, Firewalls and System Security
    Got Hit By A Torjan With UAC Bypass: Hello , my name is zak and i've been hit by torjan planted in a program that was supposed to create keyloggers , upon launch of the program i received a message stating an error which i thought was suspicious because its one of the features of this keylogger to display an...
  8. SFTP command for automatic batch job

    in Windows 10 Customization
    SFTP command for automatic batch job: psftp *** Email address is removed for privacy *** -l username -pw password If I am using sftp in windows 10, what is the command to put the password behind like psftp ?...
  9. Running an uneditable Batch file

    in AntiVirus, Firewalls and System Security
    Running an uneditable Batch file: Hi people, Got a task to run a certain CMD command on a number of PCs as administrator. So I thought i would create a batch file doing this. This is not the issue. The issue is that I am unable to lock down successfully so people cannot just edit the file to see the admin...
  10. Windows 10 backup using a batch file

    in Windows 10 Backup and Restore
    Windows 10 backup using a batch file: Hello I hope someone can help. We use a script which runs a batch file to backup laptops at the company I work at. To get it to work in Windows 7 we just add the user to the backup operators group. We have just started a few people with Windows 10. Set them up in the same...

Users found this page by searching for:

  1. genie backup manager batch