Unable to run the migration preparation tool on SBS server

Symptoms

While attempting a migration to SBS2008 OR SBS2011, Migration Preparation tool fails on Health Scan test and we get following in the SourceTool.log



12/02/2011 08:51:09          Starting health scan using MBCA engine..
12/02/2011 08:51:10          Health scan: MBCA model has been imported.
12/02/2011 08:51:10  !Error! BPAEngine: Microsoft.WindowsServerSolutions.SmallBusinessServer.Tools.MigrationPrep.Wizard.BPAException: Unexpected PSRuntime exception. ---> System.Management.Automation.CmdletInvocationException: Windows PowerShell updated your execution policy successfully, but the setting is overridden by a policy defined at a more specific scope.  Due to the override, your shell will retain its current effective execution policy of "Unrestricted". Type "Get-ExecutionPolicy -List" to view your execution policy settings. For more information, please see "Get-Help Set-ExecutionPolicy." ---> System.Security.SecurityException: Security error.

   at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)

The Zone of the assembly that failed was:MyComputer

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

   at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input, Hashtable errorResults, Boolean enumerate)

   at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecute(Array input, Hashtable errorResults)

   at System.Management.Automation.Runspaces.LocalPipeline.InvokeHelper()

   at System.Management.Automation.Runspaces.LocalPipeline.InvokeThreadProc()

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

   at Microsoft.WindowsServerSolutions.SmallBusinessServer.Tools.MigrationPrep.Wizard.MBCAEngine.Run()

   at Microsoft.WindowsServerSolutions.SmallBusinessServer.Tools.MigrationPrep.Wizard.BPALauncher.Run()

12/02/2011 08:51:10          Unexpected errors occurred during BPA scan.

Cause

Windows PowerShell supports a Group Policy setting ("Turn on script execution") that sets the execution policy for Windows PowerShell.

If this group policy is enabled, the migration preparation tool will fail.

Resolution

If you run Set-ExecutionPolicy -ExecutionPolicy:Undefined -Scope:UserPolicy, it will fail with following error message :

Set-ExecutionPolicy : Cannot set execution policy. Execution policies at the MachinePolicy or UserPolicy scopes must be set through Group Policy.
At line:1 char:20
+ Set-ExecutionPolicy <<<<  -ExecutionPolicy:Undefined -Scope:MachinePolicy    + CategoryInfo          : InvalidOperation: (:) [Set-ExecutionPolicy], InvalidOperationException
+ FullyQualifiedErrorId : CantSetGroupPolicy,Microsoft.PowerShell.Commands   .SetExecutionPolicyCommand




Check in Rsop.msc for a Group Policy setting "Turn on script execution" , supported by Windows powerShell.

For more information about this policy , check http://www.microsoft.com/download/en/details.aspx?id=25119

Disable the policy which could be defined at following level : 


•User Configuration\Windows Components\Windows PowerShell

OR

•Computer Configuration\Windows Components\Windows PowerShell



Change that to 'Not configured'. Run Gpupdate /force

More Information

You can check the execution policy defined on the server by runing command -> Get-ExcecutionPolicy -list. By default the output should look like as follows : 

                                  Scope                         ExecutionPolicy

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

                          MachinePolicy                               Undefined

                             UserPolicy                            Undefined

                                Process                               Undefined

                            CurrentUser                            Undefined

                           LocalMachine                            RemoteSigned

Properties

Article ID: 2652240 - Last Review: Jan 20, 2012 - Revision: 1

Microsoft Windows Small Business Server 2003 Premium Edition, Microsoft Windows Small Business Server 2003 R2 Premium Edition, Microsoft Windows Small Business Server 2003 R2 Standard Edition, Microsoft Windows Small Business Server 2003 Service Pack 1, Microsoft Windows Small Business Server 2003 Standard Edition, Windows Small Business Server 2008 Premium, Windows Small Business Server 2008 Standard

Feedback