Solved

Need to office 365 commands - Bulk remove autoforward and bulk get DN legacy for all users

Posted on 2014-11-06
5
231 Views
Last Modified: 2014-11-12
i need to turn off auto forward for all users in list and need to get all dn legacy for all users.
0
Comment
Question by:Jorge Ocampo
  • 2
  • 2
5 Comments
 
LVL 5

Expert Comment

by:basil2912
ID: 40426823
Hello,

Since there is no transport settings we can use the RBAC policy to prevent users for messages forwarding question - see http://community.office365.com/en-us/f/148/t/23307.aspx for how to do it.

Get-Mailbox | fl name,legacyExchangedn for the attribute you need.
Can export it to a file by adding > c:\file.txt to the cmdlet or add export-csv switch.
0
 
LVL 2

Author Comment

by:Jorge Ocampo
ID: 40426856
i thought to cancel we would use something like

o cancel the email forwarding, you can use the cmdlet below:

Set-Mailbox -Identity <mailbox@mydomain.com> -DeliverToMailboxAndForward $false -ForwardingSMTPAddress $null

This cmdlet should be able to work.

but thats for one user
0
 
LVL 5

Expert Comment

by:basil2912
ID: 40426885
Not very sure if user cannot set it afterwards.

The cmdlet deactivates it only and the delivertomailboxandforward mentions only if in case messages are forwarded they should be or not also kept in the recipient's mailbox.

The RBAC is used because simply the users are forbidden to use the autoforward settings.

You can also create a transport rule to reject all automated messages, but it will include OOF.
0
 
LVL 2

Author Comment

by:Jorge Ocampo
ID: 40426947
i dont want to disable forever just this instance i am migrating to there mailbox and dont want duplicates
0
 
LVL 38

Accepted Solution

by:
Vasil Michev (MVP) earned 500 total points
ID: 40428367
If you want to use it against all mailboxes, do this:

Get-Mailbox  | Set-Mailbox -DeliverToMailboxAndForward $false -ForwardingSMTPAddress $null

Open in new window


To get the LegacyDN for all users, do this:

Get-Mailbox -ResultSize Unlimited | select Name,Alias,UserPrincipalName,LegacyExchangeDN | export-csv -nti c:\legacydn.csv

Open in new window

0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Follow this checklist to learn more about the 15 things you should never include in an email signature from personal quotes, animated gifs and out-of-date marketing content.
Scam emails are a huge burden for many businesses. Spotting one is not always easy. Follow our tips to identify if an email you receive is a scam.
In this video we show how to create an email address policy in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Mail Flow…
how to add IIS SMTP to handle application/Scanner relays into office 365.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now