Skip to main content
edited tags
Link
John John
  • 1
  • 49
  • 258
  • 603
Source Link
John John
  • 1
  • 49
  • 258
  • 603

Backup-SPFarm : You need to have Machine administrator priviliges to run this cmdlet

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:-

enter image description here

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:- enter image description here

so can anyone advice on this?