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?.
Could you view the OWAMailboxPolicy name by running the command "Get-CASMailbox -Identity "Mailbox Name" | fl Name, OWAMailboxPolicy, OWAEnabled" when you try to create and apply a new policy for a test mailbox?
If the value of OWAMailboxPolicy parameter is empty, according to Andy David's reply in the thread "How can I find out what Owa mailbox Policy Users have", this mailbox is using a default OWAMailboxPolicy:
ok, let's start from begin: what version of Exchange behind? name of polices are usually stored in OwaMailboxPolicy. And real in not embedded in C# those field do not exists or it's empty?