I am running following script in powershell script and getting error.
$queues = Get-WmiObject Win32_PerfFormattedData_msmq_MSMQQueue
$list = $queues | ft -property Name,MessagesInQueue
for ( $i = 0; $i -lt 6; $i++ ) {
if ($i -gt 2) {
$list[$i]
}
}
Error: out-lineoutput : The object of type "Microsoft.PowerShell.Commands.Internal.Format.FormatEntryData" is not valid or not in the correct sequence. This is likely caused by a user-specified "format-*" command which is conflicting with the default formatting. + CategoryInfo : InvalidData: (:) [out-lineoutput], InvalidOperationException + FullyQualifiedErrorId : ConsoleLineOutputOutOfSequencePacket,Microsoft.PowerShell.Commands.OutLineOutputCommand