Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2014-11-06
5
Medium Priority
?
256 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 44

Accepted Solution

by:
Vasil Michev (MVP) earned 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

With its various features, Office 365 can not only help you with your day-to-day business tasks, it can also do wonders for your marketing campaign.
With so many activities to perform, Exchange administrators are always busy in organizations. If everything, including Exchange Servers, Outlook clients, and Office 365 accounts work without any issues, they can sit and relax. But unfortunately, it…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

971 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