Author Posts

January 1, 2012 at 12:00 am

by totalnet32 at 2013-03-06 16:24:04

I was hoping to email all users that have full access to shared mailboxes on one particular storage group. I need to see if I can delete shared mailboxes that are not needed. they are just regular mailboxes used for mass mailing.

I was thinking of using powershell to export all mailbox names with full access Permission and then have send-message email users with a "canned email"
With having a txt file i can test/control when and what user receive the email.

[PS] Get-Mailbox -ResultSize unlimited -database 'server\storage\db01'| Sort-Object -Property Identity | Get-MailboxPermission | where { ($_.AccessRights -eq "FullAccess") -and ($_.IsInherited -eq $false) -and -not ($_.User -like "N
T AUTHORITY\SELF") } | ft identity, user > c:\temp\text.txt

I would need the identity field to be in the subject and the user property in the TO field.
The foreach-object is giving me an issue.
please help

by DonJ at 2013-03-07 08:07:21

It's harder because you're trying to cram it all into a one-liner. And then formatting it into a table and sticking it in a text file ;).


$mailboxes = Get-Mailbox -ResultSize unlimited -database 'server\storage\db01'| Sort-Object -Property Identity | Get-MailboxPermission | where { ($_.AccessRights -eq "FullAccess") -and ($_.IsInherited -eq $false) -and -not ($_.User -like "N
T AUTHORITY\SELF") }

foreach ($mailbox in $mailboxes) {
# do something with $mailbox
}

That's probably an easier pattern to work with. You can work with each mailbox individually in $mailbox that way.