Backup-SPSite : The term Backup-SPSite is not recognized as the name of a cmdlet function script file or operable program

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:

The term Backup-SPSite is not recognized as the name of a cmdlet function script file or operable program
The term Backup-SPSite is not recognized as the name of a cmdlet function script file or operable program

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

Backup-SPSite : The term Backup-SPSite is not recognized as the name of a cmdlet function script file or operable program
Backup-SPSite : The term Backup-SPSite is not recognized as the name of a cmdlet function script file or operable program

After you execute this, the error will not come.

Read some PowerShell tutorials:

This tutorial, we learned how to fix error, the term ‘backup-spsite’ is not recognized as the name of a cmdlet.

>