I want to get the name of OWA Mailbox Policy enabled on a mailbox. Using Get-CASMailbox command I'm able to know either OWA policy is enabled on a mailbox or not but unable to get the name of OWA Mailbox Policy if it is enabled.
If I talk about ActiveSync Policy Get-CASMailbox command can return information about either ActiveSync policy is enabled or not as well the name of ActiveSync Policy name if it is enabled but does not returns the name of OWA Mailbox Policy.
I' using this command in this way
var asEnabled = false; var asPolicyName = string.Empty; var owaEnableed = false;
var owaPolicyName = string.Empty;
Command cmd = new Command("Get-CASMailbox");
cmd.Parameters.Add("identity", "abc");
cmd.Parameters.Add("DomainController", "abc");
Pipeline pipeline = RunspaceFactory.CreateRunspace(RunspaceConfiguration.Create()).CreatePipeline();
pipeline.Commands.Add(cmd);
var result = pipeline.invoke();
foreach (PSObject ps in results)
{
if (ps.Members["ActiveSyncEnabled"].Value != null)
{
asEnabled = ps.Members["ActiveSyncEnabled"].Value.ToString().ToLowerInvariant() == "true" ? true : false;
}
if (ps.Members["OWAEnabled"].Value != null)
{
owaEnabled = ps.Members["OWAEnabled"].Value.ToString().ToLowerInvariant() == "true" ? true : false;
}
if (ps.Members["ActiveSyncMailboxPolicy"].Value != null)
{
asPolicyName = ps.Members["ActiveSyncMailboxPolicy"].Value.ToString(); //returns name of ActiveSync policy enabled
}
//want to get the name of OWAMailboxPolicy but **Get-CASMailbox** does not return it
}
All this part of code is working fine but Get-CASMailbox does not contain OWAMailboxPolicy parameter so unable to get the name of OWA Mailbox Policy enabled on that mailbox.
I need help how may I get the name of OWAMailboxPolicy name enabled on a specific mailbox?.