Wednesday, February 5, 2014

Installing SharePoint 2010 with AutoSPInstaller on Windows Server 2012

The bad news;  this will not work out of the box. The good news; it’s not that hard to fix.
The issues are related to PowerShell v2 vs. v3 and .NET runtime v2 vs. v4. The catch 22 is that SharePoint commandlets requires PowerShell v2 with .NET runtime v2, while the WebAdministration commandslets in Windows Server 2012 requires PowerShell v3 and .NET runtime v4.
The error you get if you do not copy WebAdministration from a 2008 server is something like:
import-module : The 'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\webadministration\webadministration.psd1' module cannot be imported because its manifest contains one or more members that are not valid. The valid manifest members
are ('ModuleToProcess', 'NestedModules', 'GUID', 'Author', 'CompanyName', 'Copyright', 'ModuleVersion', 'Description', 'PowerShellVersion', 'PowerShellHostName', 'PowerShellHostVersion', 'CLRVersion', 'DotNetFrameworkVersion', 'Processor
Architecture', 'RequiredModules', 'TypesToProcess', 'FormatsToProcess', 'ScriptsToProcess', 'PrivateData', 'RequiredAssemblies', 'ModuleList', 'FileList', 'FunctionsToExport', 'VariablesToExport', 'AliasesToExport', 'CmdletsToExport'). Remove the members that are not valid ('HelpInfoUri')

Below I’ll underline the steps to get this working.

Step 1

Copy the folder C:\Windows\System32\WindowsPowerShell\v1.0\Modules\WebAdministration from a Windows Server 2008 R2 over to your 2012 server.

Step 2

Change line 6229(function ImportWebAdministration) in AutoSPInstallerFunctions.ps1 from

Import-Module WebAdministration

to

Import-Module –Name <path of copied folder step 1>\WebAdministration.psd1

Step 3

Edit AutoSPInstallerLaunch.bat at line 57 where you add the -version 2 parameter before –NoExit

"%SYSTEMROOT%\system32\windowspowershell\v1.0\powershell.exe" -Command Start-Process "$PSHOME\powershell.exe" -Verb RunAs -ArgumentList "'-version 2 -NoExit -ExecutionPolicy Bypass %~dp0\AutoSPInstallerMain.ps1 %InputFile%'"

Now you should be all set to get it all up and running as long as your config script is correct :-)

Other issues you may encounter

HTTPS

If you set up your sites using https, you will get an error when the code is trying to assign the certificate to your web site. This can be fixed by going to IIS Manager, click your site, click Bindings, click Edit and choose the certificate from the dropdown. In my case the *.local self-signed wildcard one.

In order to overcome this you can comment out line 2386-2401 in AutoSpInstallerFunctions.ps1 which deal with assigning the certificate to the sites.

UPA

If you opt to provision UPA/UPS more PowerShell windows will be spawned and you have to add the –version 2 line in more places. Search for powershell.exe and modify accordingly.

6 comments:

  1. I tested this solution and ended up with an error.
    "Attempting to perform the Start operation on the 'WebAdministration' provider failed. Arthmetic operation resulted in an overflow.

    ReplyDelete
    Replies
    1. Hi,
      what line gave you the error?

      Delete
    2. Hi,
      getting the same error. It appears when i Load the IIS Module from 2008r2 Server.
      When i Try loading it with PowerShell 3.0 it works.
      I am a Little confused now.

      Delete
    3. I would be confused as well. Does the 2008R2 have Powershell 3 installed?

      Delete
  2. An alternative solution is Step 3 (add -version 2), as you've outlined, then after autospinstaller fails out, use the product configuration wizard. You will need to recreate the BDC service to clean up the database name (maybe others, I did a very minimal install), but it doesn't require a donor 08r2 system. Working on a pure custom function solution, but thought this might be useful for other folks who search for this. (also works for Foundation if you avoid unsupported services and custom out the language pack). Cheers!

    ReplyDelete
    Replies
    1. Nice addition there :) But the lesson is, don't install SP2010 on 2012 Server - too much hassle.

      Delete