I was setting up a SharePoint Foundation Server 2010 SP2 site for a client which the OS it was running on was Windows Server 2012 R2. Now the installation, setting up the sites, and etc went fine. Until I started setting up Powershell scripts with a combination of BAT files and Task Scheduler tasks to run them (I’m a bit old school :P). At first the Task Scheduler task would run them but they would complete too quickly and there were no results from the Powershell scripts. I decided to open up a Powershell console and run the Powershell script themselves. When I tried running the PowerShell script, I got this nice error.