Object of type "Microsoft.PowerShell.Commands.Internal.Format.FormatEntryData" is not legal

This post has 2 Replies | 1 Follower

Top 50 Contributor
Posts 56
Albert Widjaja Posted: 02-02-2011 6:34 PM

Hi Everyone,

I'd like to know why the formatting for this powershell doesn't work ?

[PS] C:\>Get-MailboxStatistics | sort-object -descending totalItemSize | ft -autosize DisplayName, @{expression={$_.totalitem
size.value.ToMB()};label=”Mailbox Size(MB)”}, itemcount, lastlogontime | Sort-Object Itemcount

out-lineoutput : Object of type "Microsoft.PowerShell.Commands.Internal.Format.FormatEntryData" is not legal or not in the correct sequence. This is likely caused by a user-specified "format-*" command which is conflicting with the default formatti
ng.

any pointer to correction would be greatly appreciated.

 

Thanks.

 

Top 50 Contributor
Posts 51

I think that  there is problem due to location

Format-* must locate last pipeline , so

before formating, sort 2 property and then formating

Get-MailboxStatistics -database testdb1 | sort-object -property `
  @{Expression="ItemCount";Descending=$true}, `
 @{Expression="totalItemSize";Descending=$false} `
| ft -autosize DisplayName, @{expression={$_.totalitemsize.value.ToMB()}; label="Mailbox Size(MB)"}, `
itemcount, lastlogontime

Top 50 Contributor
Posts 56

ahh, IC

thanks for the correction man :-)

Page 1 of 1 (3 items) | RSS
Copyright 2012 PowerShell.com. All rights reserved.