I am working on a sharepoint on-premises farm 2016, and i created a scheduler task to do a backup for the whole farm + each site collection separately.
here is the action inside the task scheduler:-
here is the backup.bat
file:-
"%SYSTEMROOT%\system32\windowspowershell\v1.0\powershell.exe" -Command Start-Process "$PSHOME\powershell.exe" -Verb RunAs -ArgumentList "'%~dp0\backup.ps1'"
and the backup.ps1
, is as follow:-
Backup-SPFarm -Directory \\***\Back -BackupMethod full -BackupThreads 10 -Force
Backup-spsite -identity http://***/ -path c:\Back\main.bak –force
Backup-spsite -identity http://***/sites/Info -path c:\Back\info.bak –force
Backup-spsite -identity http://***/offices/ -path c:\Back\offices.bak –force
now i have noted that the task will only create 3 .bak
files representing the site collection backups, but the first command for backuping the farm will not generate any files/folder, and when i tried to run this command manually i got this error:-
PS C:\batchfiles> C:\batchfiles\backup.ps1
Backup-SPFarm : You need to have Machine administrator priviliges to run this cmdlet.
although i am defining to run the scheduler task with highest privileges:-
so can anyone advice on this?