When I try to execute “Get-SPFarm” in PowerShell ISE on WFE I got the below error message:
Get-SPFarm : The term Get-SPFarm 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….
The mistake I have done here is PowerShell ISE is designed for windows PowerShell scripts. The script I was trying to execute is to get the FARM object and all the services running in that FARM. So we have to include SharePoint snapin to PowerShell.
Follow the below steps to execute this script in PowerShell ISE without this error:
1. Navigate to 15 hives bin folder with the below command
cd ‘.\Program Files\Common Files\microsoft shared\Web Server Extensions\15\BIN’
2. Once you move on to the bin folder add the snapin by executing the below command
3. By executing the above command PowerShell ISE will include all the SharePoint related dll files to execute any SharePoint object.
4. Now if you execute the script by clicking on F5 or by clicking on play button you will see the output seamlessly.
Hope this helps, happy development in SharePoint !!!!
I am Krishna.Vandanapu a SharePoint architect working in IT from last 12 years, I worked in SharePoint 2007, 2010, 2013, 2016 and Office 365. I have extensive hands on experience in customizing SharePoint sites from end to end. Expertise in SharePoint migration tools like Sharegate, Doc Ave and Metalogix. Migrated SharePoint sites from SharePoint 2007 to 2010 and 2010 to 2013 several times seamlessly. Implementing CSOM with Microsoft best practices. Spent quality time in configuring SharePoint application services like User Profile, Search, Managed Meta data services etc. Now exploring SharePoint Framework and SharePoint 2019