Recently I was working on a SharePoint backup and restore functionalities. When I was trying to take sharepoint site collection backup using PowerShell I got the below error which says:
Backup-SPSite : The term ‘Backup-SPSite’ 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:1 char:1
+ Backup-SPSite -Identity http://mypc/sites/MySP2016SiteCollection/ -Path E:\MySit …
+ ~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Backup-SPSite:String) [], CommandNotFound
Exception
+ FullyQualifiedErrorId : CommandNotFoundException
You can take the backup using PowerShell or also you can take backup of site collection from SharePoint 2016 central administration. Here I was trying with PowerShell and I was writing the PowerShell script in a Windows PowerShell ISE. You can also write, debug and execute the powershell script using visual studio code.
The error looks like below:
Backup-SPSite : The term ‘Backup-SPSite’ is not recognized as the name of a cmdlet, function, script file, or operable program
The best way is you can use “SharePoint 2016 management shell” and run the Backup script. The error will not come.
But if you are using Windows PowerShell ISE, then you can add the below line at the beginning to load Microsoft.SharePoint.dll.
Add-PSSnapin “Microsoft.SharePoint.PowerShell”
Or also you can use the below line which will run even if the PSSnapin already loaded.
Add-PSSnapin “Microsoft.SharePoint.PowerShell” -ErrorAction SilentlyContinue
So the full script will be like below:
Add-PSSnapin “Microsoft.SharePoint.Powershell”
Backup-SPSite -Identity http://mypc/sites/MySP2016SiteCollection/ -Path E:\MySiteCollection.bak
After you execute this, the error will not come.
Read some PowerShell tutorials:
- Delete list items created before N days using PowerShell in SharePoint Online
- Retrieve List Items Created in Last N days using PowerShell SharePoint Online
- SharePoint Online Create Workflow History List using PowerShell or using SharePoint Designer 2013
- Delete Hidden Web Application in SharePoint 2013 using PowerShell
- GridView in PowerShell in SharePoint
- The term is not recognized as the name of a cmdlet function PowerShell
- Multiple connections to a server or shared resource by the same user rename computer
- Cannot be loaded because the execution of scripts is disabled on this system while running PowerShell for SharePoint online site
- SharePoint Online: Remove-SPOSite Access denied You do not have permission to perform this action or access this resource
This tutorial, we learned how to fix error, the term ‘backup-spsite’ is not recognized as the name of a cmdlet.
Hello Everyone!! I am Bhawana a SharePoint MVP and having about 10+ years of SharePoint experience as well as in .Net technologies. I have worked in all the versions of SharePoint from wss to Office 365. I have good exposure in Customization and Migration using Nintex, Metalogix tools. Now exploring more in SharePoint 2016 🙂 Hope here I can contribute and share my knowledge to the fullest. As I believe “There is no wealth like knowledge and no poverty like ignorance”