Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

ignore errors, show me only successes(or collect success and failures)

$
0
0

Hi there

I am trying to find out whether a list of users have been through a process(in this case a mailbox move)if they have that explains why im getting errors trying to move them again without clearing their old move request.

so I start simple but then I get errors on users it cant find a mover request for:

$users|%{if(Get-MigrationUser$_  -WarningActionsilentlycontinue) {Write-Host"$_"-ForegroundColorGreen} }

Cannot process argument transformation on parameter 'Identity'. Cannot convert value "" to type

"Microsoft.Exchange.Management.Migration.MigrationUserIdParameter". Error: "Value cannot be null.

Parameter name: identity"

    + CategoryInfo          : InvalidData: (:) [Get-MigrationUser], ParameterBindin...mationException

    + FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-MigrationUser

    + PSComputerName        : ps.outlook.com

what should I do for not showing these errors and just showing where it just succeeds(finds a move request for a user)

or even better how would I collect the bad(cant find user) and good(found a user)?

Thanks in advance


Viewing all articles
Browse latest Browse all 6937

Trending Articles