Create Site Collections with "Execute PowerShell Script Action"

Jun 13, 2012 at 5:14 PM

Hi,

I am trying to create Site Collections from the work flow activity that executes powershell scripts.

I have a funtioning script that works in PS, however I get an "access denied" error when I try to run it from the workflow. The  account is the APP Pool account but I do not know where it is being denied access. I have evelvated(for test) on Config_DB, WebApp, and still no good.

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

I have set signing to false

PS T:\iLoveSharePoint.Workflow.Activities\Scripts> & .\Set-PowerActivityScriptSigning.ps1 $false


PowerActivity Script Signing is now set to False

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

I need to come up with a solution that creates site collections on a workflow and it does not appear the "Create Site" activity wil do this.

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

I am using the following code... (I added var6 & var7 in the head of the scritpt)

$siteUrl = "$var1"
$title = "$var2"
$description = ""
[int]$langCode = $var6
$template = "$var3"
$ownerLogin ="$var4"
$ownerName = "$var5"
$ownerEmail = $var7

$webApp = [Microsoft.SharePoint.Administration.SPWebApplication]::Lookup("http://<site>")
$webApp.Sites
$webApp.Sites.Add($siteUrl, $title, $description, $langCode, $template, $ownerLogin, $ownerName, $ownerEmail)
$webApp.Sites

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

Would I use the Secure Store ? If so How?

I have left Signature, $secure and Secure Store AppId varables empty in my workflow.....

I do not understand how to use these for this context.

 

Help.... Please

Derek

 

 

Oct 29, 2012 at 10:03 PM

Hi Derek just walked the same exact path than you did:
Tried Create Site
And for backup tried utilizing new SPSite (with snippets both in separate script and in inline script) in powershell actions
Last but not least tried to get same result through OM (again in separate script and inline) eventually inside  impersonation step and in elevated privileges block. No luck. 
Just tested out with secure store, yet still getting access denied problems. AppId must be the same than target application Id in Secure Store and that should do it. Did you ever get this to work?

vipasane 

Nov 7, 2012 at 2:17 PM

I ended up purchasing these actions http://www.harepoint.com/Products/HarePointWorkflowExtensions/Default.aspx

They work much better