Avatar of Marvin de Wijs
Marvin de Wijs
 asked on

Parsing variable to add calendar rights

I try to add myself to all calendars with review rights in my company (Dutch language, hence the Agenda instead of Calendar).
Unfortunately $user:\Agenda  isn't parsed because the : will be added to the $user variable.

Marked error
Get-Mailbox -ResultSize unlimited -Filter {(RecipientTypeDetails -eq 'UserMailbox') -and (Alias -ne 'Admin')} | ForEach-Object {
    $user = $_.SamAccountName
    Add-MailboxFolderPermission -identity $user:\Agenda -User me@company -AccessRights Reviewer
}

Open in new window


How could I fix this?

Many thanks in advance!
PowershellExchange

Avatar of undefined
Last Comment
Marvin de Wijs

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.
Marvin de Wijs

ASKER
Many thanks, exactly what I was looking for.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23