The term FunctionName 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.
Recently while working on a PowerShell script to copy documents from a local drive to SharePoint Online document library, I got an error which says:
The term ‘LogToSharePoint’ 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.
Here “LogToSharePoint” is my function name. The full error looks like below:

The function was like below:
Function LogToSharePoint($title, $description)
{
#Here was my code to save an item to a SharePoint online list.
}
Ans I was calling like below:
LogToSharePoint -title "My Item Title" -description "My Item Description"
the term is not recognized as the name of a cmdlet function PowerShell
The same PowerShell command was working fine in one of the dev server (Windows 7) machine. But when tried to run in the Windows server 2012 r2 machine, it gave the above error.
One solution I found out was Script interpretation are synchronous in Powershell. So until the interpreter gets to the function, it does not know that the function exists.
I added the function at the bottom of the script after the calling command.
Read some SharePoint PowerShell tutorials:
- Enable or Disable List Throttling using PowerShell in SharePoint 2013
- Bulk SharePoint Online Site Collection Creation using PowerShell
- Delete Hidden Web Application in SharePoint 2013 using PowerShell
- Hide Document Library or Lists using PowerShell in SharePoint 2016 or SharePoint 2013
- Increase SharePoint Online Storage Quota using PowerShell
- How to send email using PowerShell in Office 365
- Exception calling ExecuteQuery with 0 argument(s): Unable to connect to the remote server SharePoint
- SharePoint Online: Remove-SPOSite Access denied You do not have permission to perform this action or access this resource
Then I moved the command to the top of the script and it worked fine without giving any error.
I am Bijay a Microsoft MVP (8 times –Â My MVP Profile) in SharePoint and have more than 15 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com