1

i am trying to run the following script using windows power shell ISE:-

Add-PSSnapin Microsoft.SharePoint.PowerShell
$cat = Get-SPBackupCatalog \\T01\Back 
Backup-SPFarm -Directory \\T01\Back -BackupMethod Full -BackupThreads 10 -Force      
$cat.Refresh()
$cat | Remove-SPBackupCatalog -RetainCount 1 -Confirm:$false
$cat.Refresh() 
$cat | Send-SPBackupStatus -Recipients "********"

but i got the following error:-

Get-SPBackupCatalog : The term 'Get-SPBackupCatalog' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:2 char:8 + $cat = Get-SPBackupCatalog \T01\Back + ~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Get-SPBackupCatalog:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

can anyone advice please?

5

I can't see that you have run the SharePointBAC.ps1 in your script, which is downloaded from the Codeplex page SharePoint Backup Augmentation Cmdlets. The scripts

  • Get-SPBackupCatalog
  • Set-SPBackupCatalog
  • Remove-SPBackupCatalog
  • Export-SPBackupCatalog

is not out-of-the-box native cmdlets in SharePoint Management Shell or PowerShell ISE with the reference of Add-PSSnapin Microsoft.SharePoint.PowerShell.

  • ok i got your point , i though i can use them out of the box. but my main reason is that when i backup my farm it will create new backup folder instead of replacing existing one. although i specify -Force in my backup script , which look like this:-"Backup-SPFarm -Directory \\T01\Back -BackupMethod Full -BackupThreads 10 -Force". so is there an out of the box approach to force replacing existing backup file with new one? thanks – john Gu Oct 23 '14 at 11:58
  • 1
    @johnG The -Force attribute only forces to perform backup even if SharePoint thinks the server lacks disk space. AFAIK this doesn't overwrite excisting files. You probably need to remove the previous backup first and run the Backup-SPFarm after. technet.microsoft.com/en-us/library/ff607881(v=office.15).aspx – Benny Skogberg Oct 23 '14 at 12:06
3

That is not an official SP commandlet

You can download it on codeplex https://sharepointbac.codeplex.com/

After downloading you install it by running the "SharePointBAC.ps1" included in the download Further Documentation

  • But does SharePoint provides an out-of-the-box approach to replace existing backup farm file ?. because unlike site collection backups using -force inside the Backup-SPFarm will not replace existing file ? can you advice please? – john Gu Oct 23 '14 at 12:00
  • You would have to delete the contents of the folder. – Choggo Oct 23 '14 at 12:03
  • so will this work for example "Remove-Item -recurse c:\Backup* " ??? – john Gu Oct 23 '14 at 13:13
  • 1
    make sure to run it with the -whatif parameter before hand as a test, just to be sure, but yeah, that should do it. the * may be unecessary. – Choggo Oct 23 '14 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.