First published on MSDN on Apr 29, 2016
It is important to understand that the PowerShell Workflow is a great tool to complete task that require a PowerShell activity but it is limited when performing actions on a bulk amount of objects simultaneously and it lacks the ability for a retry, for example what happens if the PowerShell activity is triggered and the activity fails? if the destination isn't available? or any other reason why a script might fail what happens? By no means is this post trying to discourage you from using the Workflow activity but rather the opposite, my goal is to encourage you to push the envelope and do great things with FIM / MIM but always consider any possible adverse effects. In fact I often tell my customers I can get FIM / MIM to do just about anything but just because i can doesn't mean i should. Always use the right tool for the job, "dont use pliers to hammer a nail" With all that in mind lets create some PowerShell Workflows.
The following example is just a simple Get-Date activity which i am using to demo the use of the activity.
Notice that in the script i added a Return which is will be used to pass the results back into the portal to be used later on in additional steps or even just to write a value back to the object initiating the activity.
Additionally i added [//WorkflowData/GetDate] to the Return Value Lookup field which will take the return value and pass it to the [//Workflow/Data/GetDate] .
Additional PowerShell Workflow Activities ( I will periodically update the blog with additional examples of the PowerShell Workflow Activity and they will be posted below)
Using the WAL to create a Home Directory, the 2 post below show examples of how to take DATA for a newly created User and create the Users Home Directory. The one marked Server 2010 or Earlier was before the .NET change for Server 2012. Because Server 2012 uses a newer version of .NET you have to format the PowerShell Workflow a little bit differently using parameters which is detail in the "(WAL) – Workflow Example – Create Home Directory" activity.
(WAL) – Workflow Example – Create Home Directory
Provision a Home Directory for new Accounts (Server 2010 or Earlier)