Forum Discussion
mdcastorena
Jul 07, 2023Brass Contributor
PS export to see if users are sharing their calendar details in Outlook
Hi all, and happy Friday! Just learned there's a PowerShell community so figured I'd save myself from rabbit hole research online and start here. I am wanting to create an export/report of all...
mdcastorena
Brass Contributor
Perfect, thank you. Now how would I loop through a list of ALL mailboxes (such as CSV file listing all email addresses), or just have it display all mailboxes instead of requiring an Identity?
kevkelly
Jul 10, 2023Brass Contributor
LeonPavesic already supplied an extended example of how you could loop through all mailboxes
Given a CSV file that contains say a list of the PrimarySmtpAddress that you want to check Calendar permissions for, a simple script that would loop through each address might look like:
$mailboxes = Import-Csv -Path <path_to_csv_file>
foreach($mailbox in $mailboxes){
Get-MailboxFolderPermission -Identity "$($mailbox.PrimarySmtpAddress):\Calendar" -ErrorAction SilentlyContinue | Select-Object Identity, User, AccessRights, SharingPermissionFlags
}
The above is a simplified example, ideally you'd add some error handling to this script and export the results to a file rather than the console
If you wanted to query all mailboxes and not use a CSV file as the input, then you could change the $mailboxes variable to:
$mailboxes = Get-Mailbox -ResultSize Unlimited
- mdcastorenaJul 10, 2023Brass ContributorGot it, sorry - I totally missed their first response. Thank you both.