Solved

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

Posted on 2014-11-06
5
234 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 39

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

The problems with reply email signatures

Do you wish that you could place an email signature under a reply? Well, unfortunately, you can't. That great Exchange/Office 365 signature you've created will just appear at the bottom of an email chain. What a pain! Is there really no way to solve this? Well, there might be...

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what the Office 365 disclaimer function is, why you would use it and its limited ability to create Office 365 signatures.
Read this checklist to learn more about the 15 things you should never include in an email signature.
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

867 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

15 Experts available now in Live!

Get 1:1 Help Now