I am having an issue when running a swtich option in my script.
I am trying to take group the batchID results and then combine the unique names and join them
If ($CSV) { $MBX = Get-CSVFile $MigUsers = $MBX.emailaddress | Get-MigrationuserStatistics | select identity,batchid,status,statusdetail,@{label='ErrorSummary';Expression={$_.errorsummary.split('>')[0]}},percentagecomplete,bytestransferred $batch = $migusers.batchid.name | group-object | Select-Object -Unique -ExpandProperty name $batchname = $batch -join ", " }
But I keep receiving the error :
Cannot convert the "System.Object[]" value of type "System.Object[]" to type
"System.Management.Automation.SwitchParameter".
At D:\MigReport-V2.1.ps1:54 char:5
+ $batch = $migusers.batchid.name | group-object | Select-Object -U ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [], RuntimeException
+ FullyQualifiedErrorId : ConvertToFinalInvalidCastException