Solved

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

Posted on 2014-11-06
5
236 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 40

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
A brief introduction to what I consider to be the best editor for PowerShell.
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

809 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