I have a custom assembly which contains code to setup Variations for a SharePoint 2010 Publishing site. This code is based off a blog post from Waldek
I have a PowerShell script in which I create a new WebApplication and SiteCollection, I then load my custom assembly and attempt to invoke methods which setup the variations. Problem is that the CurrentUser property of the SPWeb (RootWeb) I'm trying to work with returns null, which is the underlying cause of the Access is denied error I receive.
If I decompose this into two scripts, one to do the creation and one to call the custom code, it works, provided I call them both interactively. If I wrap them into a single parent script that invokes each of them in turn I'm back to the CurrentUser being null.
Now for my required usage I need this to work in the context of a single script unattended install.
Has anyone seen this or something simialr? Or do you have any ideas as to how I might overcome this problem?