troubleshooting Question

Parsing variable to add calendar rights

Avatar of Marvin de Wijs
Marvin de Wijs asked on
PowershellExchange
2 Comments1 Solution75 ViewsLast Modified:
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
}

How could I fix this?

Many thanks in advance!
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros