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. How does Avast free bypass UAC

    in AntiVirus, Firewalls and System Security
    How does Avast free bypass UAC: Several times I have had Avast Free installed unwanted, mainly bundled with CCleaner, how does itt self install without User Account Control asking? https://answers.microsoft.com/en-us/protect/forum/all/how-does-avast-free-bypass-uac/bfd3991f-1fdd-4b73-b5ef-a48cebf2e199
  3. 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 ?...
  4. Running PowerShell script as a batch file

    in Windows 10 Network and Sharing
    Running PowerShell script as a batch file: Can I run the Power Shell line: "C:\Windows\System32>get-appxpackage *3dbuilder* | remove-appxpackage" from a .Bat file? ***Original title: Removing bloatware***...
  5. Run oscdimg.exe from a batch file?

    in Windows 10 Installation and Upgrade
    Run oscdimg.exe from a batch file?: OK, I have a batch file that copies files from a mounted windows 10 installation file and updates drivers in boot.wim and install.wim. The thing I cannot work out is how to automatically run oscdimg.exe (command from deployment and imaging environment) in a batch file so I...
  6. 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...
  7. 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...
  8. How to run batch file with powershell

    in Windows 10 Network and Sharing
    How to run batch file with powershell: I created a basic batch file that uses "net share" to share a local path. I saved the batch file. When I double click the file I get "access is denied"... note, I am logged on as a admin. Anyways... I figure it has to be run using power shell. I do not know much about...
  9. Parallel batch jobs in one scheduled task

    in Windows 10 Support
    Parallel batch jobs in one scheduled task: Parallel batch jobs in one scheduled task hi, This should be an easy answer. I want to create one scheduled task, it will be called "CLEAR_PHOTOSBYDATE", see attached pic or (approximate example, not literal job...yet)...
  10. Unable to run batch file at startup

    in Windows 10 Support
    Unable to run batch file at startup: I am trying to run a batch file with these contents: Code: ECHO OFF TIMEOUT /T 2 /NOBREAK DisplaySwitch.exe /internal TIMEOUT /T 2 /NOBREAK DisplaySwitch.exe /external[/quote] I've tried putting a shortcut to it in the startup folder, putting the bat itself in the startup...

Users found this page by searching for:

  1. genie backup manager batch