Get-MoveRequest | Get-MoveRequestStatistics

Good Evening All,

I hope someone can point me in the right direction.

I am moving mailboxes from on-prem exchange 2010 to Office 365.

I want to check the status of mailboxes moved by querying a distribution group or even by importing a csv

I can check the status of individual mailboxes by using

Get-MoveRequest “John Doe” | Get-MoveRequestStatistics

If I run Get-DistributionGroupMember “Office2 Staff”

I get the following correct output of 20 users in that group

Name RecipientType


John Doe User
John doe2 User
… User
… User
John Doe 20 User

IF i try

$DGMembers = Get-DistributionGroupMember “Office2 Staff”
foreach ($name in $DGMembers)
{Get-MoveRequest | Get-MoveRequestStatistics}

I get every mailbox in the organization and not the 20 mailboxes on the “office2 Staff”

I have also tried importing a csv file what has the following 20 columns

identity
John Doe
John Doe2
John Doe 20

$identies = Import-csv “C:\tmp\office2.csv”
foreach ($identity
in $Identies)
{get-MoveRequest | Get-MoveRequestStatistics}

again I get all mailboxes in the org.

Any ideas on how I can get just the users in the distribution group?

Kind Regards

Mar

You will need to pass the name to the get-moverequest

This

$DGMembers = Get-DistributionGroupMember "Office2 Staff"
foreach ($name in $DGMembers)
{Get-MoveRequest | Get-MoveRequestStatistics}

Should be

$DGMembers = Get-DistributionGroupMember "Office2 Staff"
foreach ($name in $DGMembers)
{Get-MoveRequest $name.name| Get-MoveRequestStatistics}

and for the csv this

$identies = Import-csv "C:\tmp\office2.csv"
foreach ($identity
in $Identies)
{get-MoveRequest | Get-MoveRequestStatistics}

should be

$identies = Import-csv "C:\tmp\office2.csv"
foreach ($identity
in $Identies)
{get-MoveRequest $identity | Get-MoveRequestStatistics}

You can also try using a calculated expression to ‘rename’ the Name property to Identity:

$results = Get-DistributionGroupMember "Office2 Staff" |
Select *, @{Name="Identity";Expression={$_.Name}} |
Get-MoveRequest | 
Get-MoveRequestStatistics

$results

Jonathan,

The 1st modification you provided works an absolute treat. Thank you indeed.Saves me a truckload of time. Thanks again.

The import-csv is however throwing an error.

Cannot process argument transformation on parameter ‘Identity’. Cannot convert value "@{PSComputerName=outlook.office365.com;
RunspaceId=##################; PSShowComputerName=FALSE; Identity=John Doe; Alias=johnd;
ArchiveGuid=00000000-0000-0000-0000-000000000000; AuthenticationType=; City=

Error: "Cannot convert hashtable to an object of the following type:
Microsoft.Exchange.MailboxReplicationService.MoveRequestIdParameter. Hashtable-to-Object conversion is not supported in restricted language mode

For a bit more info. If I import the csv and then do

$identies | get-member

I get back a lot of info. The Alias and identity is one of them

Name MemberType Definition
Alias NoteProperty System.String Alias=johnd
Identity NoteProperty System.String Identity=John Doe

I assumed that the csv only had just the Identity you will just need to specify the property to use just like the Get-DistributionGroupMember snipet

$identies = Import-csv "C:\tmp\office2.csv"
foreach ($identity
in $Identies)
{get-MoveRequest $identity.Identity | Get-MoveRequestStatistics}

Jonathan,

Thank you indeed. Works a treat.