The following PowerShell script attempts to create an Exchange mailbox for a user with (a) a retention policy and (b) an archive quota:
PSCommand command = new PSCommand();
command.AddCommand("Enable-Mailbox");
command.AddParameter("Alias", K2.ProcessInstance.DataFields["Account-ADAlias"].Value.ToString());
command.AddParameter("Identity", K2.ProcessInstance.DataFields["Account-ADAlias"].Value.ToString());
command.AddParameter("Database", K2.ProcessInstance.DataFields["Account-MailboxDatabase"].Value.ToString());
command.AddCommand("Enable-Mailbox");
command.AddParameter("Identity", K2.ProcessInstance.DataFields["Account-ADAlias"].Value.ToString());
command.AddParameter("Archive");
command.AddCommand("Set-Mailbox");
command.AddParameter("Identity", K2.ProcessInstance.DataFields["Account-ADAlias"].Value.ToString());
command.AddParameter("Database", K2.ProcessInstance.DataFields["Account-MailboxDatabase"].Value.ToString());
command.AddParameter("ArchiveQuota", "2GB");
command.AddParameter("ArchiveWarningQuota", "1.8GB");
command.AddParameter("RetentionPolicy", "No Archive Delete after 10years");
powershell.Commands = command;
The following error is generated when the script is run:
Parameter set cannot be resolved using the specified named parameters.
NOTE: The variables staring with "K2.ProcessInstance.Datafields" have all been verified as valid.
I can't figure out how to resolve this error. I've consulted the PowerShell module docs for Exchange. Any guidance appreciated.