Hello world!
Welcome to WordPress. This is your first post. Edit or delete it, then start writing!
# Rene Smit 19-10-20 Inbox rule reporter on external fwd
Connect-ExchangeOnline
$mailboxes = Get-Mailbox -ResultSize Unlimited
#mailboxes = Get-Mailbox rene.smit
$report = @()
ForEach ($mailbox in $mailboxes) {
Write-host Now Processing $mailbox.DisplayName
$inboxrrules = Get-InboxRule -Mailbox $mailbox.Alias | Select-Object Enabled, Name, Priority, From, SentTo, CopyToFolder, DeleteMessage, ForwardTo, MarkAsRead, MoveToFolder, RedirectTo, @{Expression = { $_.SendTextMessageNotificationTo }; Label = "SendTextMessageNotificationTo" }, MailboxOwnerId
foreach ($inboxrule in $inboxrrules) {
Write-host now processing rule $inboxrule.Name for $mailbox.DisplayName -ForegroundColor green
if (!$null -eq $inboxrule.ForwardTo) {
Write-Host The rule for $mailbox.Alias with name $inboxrule.Name is a fwd rule and is being forwarded to $inboxrule.ForwardTo -ForegroundColor Cyan$
$split = $inboxrule.Forwardto.split(":")[1]
$split = $split.Trim("]")
$inbfwdline = $null
$inbfwdline = [PSCustomObject][Ordered]@{
Displayname = $mailbox.Name
userPrincipalName = $mailbox.userPrincipalName
RuleName = $inboxrule.Name
Enabled = $inboxrule.Enabled
Forwardto = $inboxrule.ForwardTo
Forwardmail = $split
}
$report += $inbfwdline
}
}
}
#$report
$Report | Export-csv -NoTypeInformation "C:\temp\InboxRules_Forwards.csv"
Hier nog een mooie code
OF anders ZO
en rtoen kwam er een gans
Hi, this is a comment.
To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard.
Commenter avatars come from Gravatar.
gedraag je en ga naar: https://gist.github.com/tabs-not-spaces/136f12f1c9fed70f739e7f2a52406934.js