Error loading SharePoint Powershell Snapin

Jul 1, 2011 at 2:12 PM

Hi,

I am having an issue running the autospinstaller script.  The first time I run it, everything works great until it gets to the part where it is loading the SharePoint Powershell Snapin.  At that point, I get the error below.  I can restart the script and it continues on past this point without hitting the error, but I would really like to get it to work the first time it runs.  Any ideas?

Thanks!

--------------------------------------------------------------

- Loading SharePoint Powershell Snapin

The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered.

No xml configuration files loaded.

The type initializer for 'Microsoft.SharePoint.Utilities.SPUtility' threw an exception.

--------------------------------------------------------------

Script aborted!

 

 

Exception             : System.TypeInitializationException: The type initializer for 'Microsoft.SharePoint.Utilities.SPUtility' threw

                       an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Core, Version=3.5.

                       0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the

                       file specified.

                       File name: 'System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

                           at Microsoft.SharePoint.Utilities.SPReaderWriterLock ..ctor(String lockName)

                           at Microsoft.SharePoint.Administration.SPCache`2..ctor(String cacheName)

                           at Microsoft.SharePoint.Administration.SPVolatileCache`2..ctor(String cacheName)

                           at Microsoft.SharePoint.Utilities.SPUtility..cctor()

 

                           --- End of inner exception stack trace ---

                           at Microsoft.SharePoint.Utilities.SPUtility.GetGener icSetupPath(String strSubdir)

                           at Microsoft.SharePoint.PowerShell.SPXmlFileReader.get_PowerShellConfigPath()

                           at Microsoft.SharePoint.PowerShell.SPXmlFileReader.get_PowerShellXmlPath()

                           at Microsoft.SharePoint.PowerShell.SPCmdletSnapIn.get_Cmdlets()

                           at System.Management.Automation.Runspaces.RunspaceConfigForSingleShell.MergeCustomPSSnapIn(PSSnapInInfo mshsnapinInfo, CustomPSSnapIn customPSSnapIn)

                           at System.Management.Automation.Runspaces.RunspaceConfigForSingleShell.LoadCustomPSSnapIn(PSSnapInInfo mshsnapinInfo)

                           at System.Management.Automation.Runspaces.RunspaceConfigForSingleShell.LoadPSSnapIn(PSSnapInInfo mshsnapinInfo)

                           at System.Management.Automation.Runspaces.RunspaceConfigForSingleShell.LoadPSSnapIn(PSSnapInInfo mshsnapinInfo, PSSnapInException& warning)

                           at System.Management.Automation.Runspaces.RunspaceConfigForSingleShell.DoAddPSSnapIn(String name, PSSnapInException& warning)

                           at Microsoft.PowerShell.Commands.AddPSSnapinCommand.AddPSSnapIns(Collection`1 snapInList)

                           at Microsoft.PowerShell.Commands.AddPSSnapinCommand.ProcessRecord()

                           at System.Management.Automation.CommandProcessor.ProcessRecord()

TargetObject         :

CategoryInfo         : NotSpecified: (:) [Add-PSSnapin], TypeInitializationException

FullyQualifiedErrorId : System.TypeInitializationException,Microsoft.PowerShell.Commands.AddPSSnapinCommand

ErrorDetails         :

InvocationInfo       : System.Management.Automation.InvocationInfo

PipelineIterationInfo : {0, 1, 0}

PSMessageDetails     :

-----------------------------------

| Automated SP2010 install script |

| Started on: 07/01/2011 08:36:42 |

| Aborted:   07/01/2011 08:57:42 |

-----------------------------------

Transcript stopped, output file is C:\Users\sp_setup\Desktop\AutoSPInstaller-2011-07-01_8-36.rtf

Press any key to exit...

Coordinator
Jul 7, 2011 at 11:20 AM

I've been having the same issue (but only very recently it seems). Check this article for a good technical hypothesis, and a possible workaround: http://blogs.msdn.com/b/jorman/archive/2011/04/12/add-pssnapin-microsoft-sharepoint-powershell-failing-after-sharepoint-install.aspx

For me it's just as easy right now to run the script twice as you discovered.

Brian

Jul 7, 2011 at 1:04 PM

Thanks, Brian!  I think I'll also stick with running the script twice.  :)

Jul 19, 2011 at 7:36 PM

I hit this one today as well. First time I've tried everything in one go - prereqs offline and install binaries before farm config. Running the batch file again and the snapin loaded fine.

for ref it is fully patched win 2008 r2 with slipstreamed RTM + SP1 + reissued June CU for install source.

Iain

Jul 19, 2011 at 8:30 PM

Same here, and as you said, when you run it a second time it works. So, I know to rerun it.

Jul 26, 2011 at 11:10 AM

Hi All,

Did anyone find a solution to the above error, rather than just running the script twice? It doesn't look that nice when you get the error especially if you give it to someone who is unfamiliar with the script!

Look forward to hearing from you!

 

 

Coordinator
Dec 17, 2011 at 3:54 AM

BTW in case you haven't checked lately, I implemented a workaround a few releases ago that re-starts the whole process automatically without having to manually re-run the script.

Cheers
Brian