Avatar of Fr. Vandecan
Fr. Vandecan
Flag for Belgium asked on

Powershell - Get-mailbox what's wrong in this statement?

$Item.Code_Site = "LO"

$JCAlias = (Get-Mailbox -RecipientTypeDetails sharedmailbox | Where-object {($_.CustomAttribute1 -eq $Item.Code_Site)}.Alias)

ERROR : The property Alias cannot be found on this object. Verify that the property exist....

Get-Mailbox has a property called alias..

so something is wrong in my statement.....

PS I I remove .alias  I get the name of the mailbox

$JC = Get-Mailbox -RecipientTypeDetails sharedmailbox | Where-object {($_.CustomAttribute1 -eq $Item.Code_Site)}

BUT this is not what I need....
PowershellExchangeActive Directory

Avatar of undefined
Last Comment
Jeremy Weisinger

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
oBdA

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Jeremy Weisinger

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
oBdA

Suggest a split. Both are valid solutions, just two ways to achieve the same thing.
Jeremy Weisinger

Both valid.
I should also clarify that the original question had the wrong syntax. oBdA’s syntax is, of corse, correct.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes