This has earlier been reported as a Microsoft Case (SRZ091204000273) but without a resolution.
The problem we have is that on our Windows 2003 R2 SP2 SharePoint farm (3 WFE) we have created a PowerShell script to be able to recreate Web Applications in case of a disaster and recovery. The script worked fine until we installed Windows Management FrameWork Core. We then start to get the following error:
"ProvisionGlobally" with "0" argument(s): "Object reference not set to an instance of an object."
If you remove the Framework and reboot the script starts to work again. In our MS case we hade we used on request by MS to try the simpliest script to create a web application and provision it:
$spFarm = [Microsoft.SharePoint.Administration.SPFarm]::Local
$appBuilder = New-Object Microsoft.SharePoint.Administration.SPWebApplicationBuilder $spFarm
$spWebApp = $appBuilder.Create()
The above code does not work either when you have a farm. What happens is that on the machine where you run the script the IIS website and application pool is created but only on the local machine.
The same script on a singel server installation works fine and when using the Provision() or ProvisionGlobally()
In the MS case we tried the same code as a console application written i C# and that works fine. Using Central Administration is also working fine.
In addition we have also tried on several SharePoint farms and not only one.