Windows 10: Windows 10 backup using a batch file

  1.    28 Mar 2017 #1

    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 way.
    C:\Data"contains batch file"
    Desktop "contains script"
    User added to the backup operators group.

    However the backup doesn't run we get an access error which in Windows 7 always meant the user wasn't in the backup operators group. This is either running the script or the batch file directly.

    Edit: this fails if the user is a standard user or an Administrator.

    The batch file will run fine if we right click and "run as administrator".

    UAC is switched off.

    Is there any other changes permissions wise we need to make?

    Thanks in advance
      My ComputerSystem Spec


  2. Posts : 1,981
    Windows 3.1 to Windows 10
       28 Mar 2017 #2

    Since you have UAC turn off add this to the top of your batch file

    Code:
    set "params=%*"
    setlocal EnableDelayedExpansion
    cd /d "%~dp0" && ( if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs" ) && fsutil dirty query %systemdrive% 1>nul 2>nul || (  echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "cmd.exe", "/k cd ""%~sdp0"" && %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs" && "%temp%\getadmin.vbs" && exit /B )
    
    %windir%\system32\reg.exe query "HKU\S-1-5-19" 1>nul 2>nul || (
    echo ============================================================
    echo ERROR: Run The Script As Administrator.
    echo ============================================================
    echo.
    echo.
    echo Press any key to exit...
    pause >nul
    goto :eof
    )
    the ERROR message is there just in case, although batch will start / run as admin
      My ComputerSystem Spec


 

Related Threads
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....
A .bat file is a batch file that consists of a series of commands to be executed by the command line interpreter, stored in a plain text file. The New context menu allows users to quickly create new files, folders, and shortcuts. You can right...
I've been working to get some speed back on my laptop but I haven't been able to understand where or how I can get the text that needs to be pasted in the .bat file. I've looked and looked and can't find a clear answer anywhere.
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 00:05.
Find Us