FIM Codeplex Powershell & smallest Exch database & provision mailbox
Hi, So I finally have the FIM codeplex activity working and it is provisioning mailboxes correctly. Next, I would like for it to first evaluate exchange & determine which is the smallest db, but how do I pass this $smallExchDB variable (which is the output of the script) to the command 'enable-mailbox -identity domain\username -database '$smallExchDB' This is what I have done: One Workflow: First function populates [//workflowdata/accountname] with the accountName attribute (this works)Second function runs the 'smallest exchange db' script and the last line is: $workflowdata ['smallestDB'] = $identityofsmallEXDB (which contains the correct details, the script itself works)Third function populates [//workflowdata/smallestDB] with CustomExpression [//workflowdata/smallestDB]Fourth function runs the following: enable-mailbox -Identity adatum\$accountName -database '$smallestDB' - both $accountName and $smallestDB are in the first line under param() Should this be working? What steps am I missing? The PostProcessingError is similar to what I have seen before: Type 'System.Management.Automation.RunSpaces.RemotingErrorRecord in assembly... Its almost as if the $workflowdata ['smallestDB'] wasnt populated correctly? thanks, SK
October 3rd, 2012 2:44am

Just make sure the data you are putting in the workflow data is a POCO like a datetime, string, or int. An object that isn't serializable won't be able to be stored as an isolated app domain is created to run the script... I just tested the code itself quickly to make sure the workflow data is flowing back from the app domain and it is, I'll try to verify in my lab that the workflow data works the same when run in FIM, but I'm pretty sure I am using this functionality some where already.
Free Windows Admin Tool Kit Click here and download it now
October 3rd, 2012 7:42am

Thanks Adam, for example the output of my script and the value that is stored in the 2nd function's $smallestDB variable is: Mailbox Database 03 - I am assuming its a string.
October 3rd, 2012 8:01am

I imagine something like this *should* work: $WorkflowData['SmallestDB'] = Get-MailboxDatabase -Status | Sort-Object DatabaseSize | Select-Object -First 1 -ExpandProperty Name
Free Windows Admin Tool Kit Click here and download it now
October 3rd, 2012 8:05am

I have a script that does all that I found on http://social.technet.microsoft.com/Forums/en-US/exchangesvradmin/thread/36c464ff-8574-4dba-8384-12c5c266d3ba/ so at the end of that script the database value is stored in a variable, and I assign it to 'workflowdata' here is another thought - which might be easier: what if I run the "smallest db" script as a daily scheduled task, and write the db name to a txt file; then in the FIM powershell activity I simply pick up the contents of this txt file and pass it along to the exchange cmdlet (enable-mailbox ...). Do you think this would be possible? thank you
October 3rd, 2012 8:30am

Sorry, I assumed you were using Exchange 2010. Long as you are doing $WorkflowData['smallestdb'] = $Optimaldb.DataBaseName after the $Optimaldb = ($MBXDBTable | Sort-Object ActiveMBs | select -first 1) line then you should be good.
Free Windows Admin Tool Kit Click here and download it now
October 3rd, 2012 8:43am

Hi, I changed my logic a little bit: - now run the Smallest Exchange Database script as a daily task, with output to a text file - in the powershell activity I read the text file contents into a variable and pass it along to the 'enable-mailbox...' cmdlet and it is working :) Thanks for all your help Adam !
October 3rd, 2012 8:01pm

FYI, I am working on bug fixes and enhancements, and have fixed this bug!
Free Windows Admin Tool Kit Click here and download it now
October 19th, 2012 12:00pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics