O365 PowerShell Question

So, I have several mail migration batches for one of my clients that I am clearing out.  I can do this one at a time by using the remove-migrationbatch command in PowerShell, but, I want to try and script this so that I can run a get-migrationbatch and pipe the output of that to the remove-migrationbatch command (so I can just run that command and clean up all of the completed batches).  I am thinking something like this:

Get-MigrationBatch -Status "Completed" | remove-migrationbatch -force -confirm:$false

If I run this, I get cannot processs argument transformation on parameter Identity.

I can get around in PowerShell OK and have some good scripts already, but, I am by no means an expert and still have a lot to learn. Can anyone point me in the right direction?<o:p></o:p>


June 23rd, 2015 9:10am

Get-MigrationBatch -Status Completed | %{remove-migrationbatch $_.Identity -force -confirm:$false}

Free Windows Admin Tool Kit Click here and download it now
June 23rd, 2015 11:51am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics