diff --git a/exchange-toolkit.ps1 b/exchange-toolkit.ps1 index 58b4bed..00746a2 100644 --- a/exchange-toolkit.ps1 +++ b/exchange-toolkit.ps1 @@ -165,8 +165,8 @@ do displayname = $mailbox.DisplayName emailAddress = $mailbox.PrimarySmtpAddress sendOnBehalfOf = $mailbox.GrantSendOnBehalfTo - sendAs = Get-ADPermission $mailbox.identity | where {($_.ExtendedRights -like “*Send-As*”) -and -not ($_.User -like “NT AUTHORITY\SELF”) -and -not ($_.User -like “s-1-5-21*”)} | % {$_.User} - fullAccess = Get-MailboxPermission $mailbox.Identity | ?{($_.IsInherited -eq $False) -and -not ($_.User -match “NT AUTHORITY”)} |Select User,Identity,@{Name=”AccessRights”;Expression={$_.AccessRights}} | % {$_.User} + sendAs = Get-ADPermission $mailbox.identity | Where-Object {($_.ExtendedRights -like “*Send-As*”) -and -not ($_.User -like “NT AUTHORITY\SELF”) -and -not ($_.User -like “s-1-5-21*”)} | ForEach-Object {$_.User} + fullAccess = Get-MailboxPermission $mailbox.Identity | Where-Object {($_.IsInherited -eq $False) -and -not ($_.User -match “NT AUTHORITY”)} |Select-Object User,Identity,@{Name=”AccessRights”;Expression={$_.AccessRights}} | ForEach-Object {$_.User} } #Add the objects to the permissions array @@ -195,8 +195,8 @@ do displayname = $mailbox.DisplayName emailAddress = $mailbox.PrimarySmtpAddress sendOnBehalfOf = $mailbox.GrantSendOnBehalfTo - sendAs = Get-ADPermission $mailbox.identity | where {($_.ExtendedRights -like “*Send-As*”) -and -not ($_.User -like “NT AUTHORITY\SELF”) -and -not ($_.User -like “s-1-5-21*”)} | % {$_.User} - fullAccess = Get-MailboxPermission $mailbox.Identity | ?{($_.IsInherited -eq $False) -and -not ($_.User -match “NT AUTHORITY”)} |Select User,Identity,@{Name=”AccessRights”;Expression={$_.AccessRights}} | % {$_.User} + sendAs = Get-ADPermission $mailbox.identity | Where-Object {($_.ExtendedRights -like “*Send-As*”) -and -not ($_.User -like “NT AUTHORITY\SELF”) -and -not ($_.User -like “s-1-5-21*”)} | ForEach-Object {$_.User} + fullAccess = Get-MailboxPermission $mailbox.Identity | Where-Object {($_.IsInherited -eq $False) -and -not ($_.User -match “NT AUTHORITY”)} |Select-Object User,Identity,@{Name=”AccessRights”;Expression={$_.AccessRights}} | ForEach-Object {$_.User} } #Add the objects to the permissions array @@ -207,7 +207,7 @@ do $permissionsArray | Format-Table $permissionsArray | Export-Csv -NoTypeInformation $csvSavePath } - + } Read-Host -Prompt 'Press Enter to Continue' } until ($selection -eq 'q')