Windows 2012 R2 Server
SharePoint 201 SP2 FARM
Have a PowerShell script that backs up the entire SharePoint farm.
On the Windows 2012 R2 server we have PowerShell 4.0 running which is installed on Windows 2012.
When I installed SharePoint it created a shortcut for SharePoint Management Powershell
I can invoke SharePoint cmdlets no issue
No I need to automate my Farm backup script.
So I created a batch file farm-backup.cmd
powershell.exe -noprofile .\Farm-Backup.ps1
When this runs I get this error
16-Jul-2015 06:00:25 Warning: An error occurred whilst checking for the My Site Host. Reason: Microsoft SharePoint is not supported with version 4.0.30319.34209 of the Microsoft .Net Runtime.
This tells me that PowerShell 4 is being used and SharePoint 2010 will not work with PowerShell v4
So my question is how can I invoke PowerShell V2 so that my batch file will work?
Thanks in advance