Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Format-table error

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 01-08-2007   #1 (permalink)
Patrick Escarcega
Guest


 

Format-table error

I'm getting the following error when calling either Format-List or Format-Table

#(removed actual names)
[Reflection.Assembly]::LoadFrom("C:\mypath\MyAssembly.dll")
$s = [MyObject]::ICollection

$s | where {$_.DisplayName -like ("*" + args[0] + "*")} | format-table
DBID,DisplayName -auto

and this is the error I'm getting

out-lineoutput : Object of Type
"Microsoft.PowerShell.Commands.Internal.Format.FormatStartData" is not legal
or not in the correct sequence. This is likely caused by a user-specified
"format-table" command which is conflicting with the default formatting.

This only happens when I'm running this as a PS1 script (file.ps1), when I
run these commands from the command-line it works fine.

And it's just the format-table command, if I remove that I get what I
expect, a long list of objects.



My System SpecsSystem Spec
Old 01-08-2007   #2 (permalink)
/\\/\\o\\/\\/ [MVP]
Guest


 

Re: Format-table error

try this :

[void] [Reflection.Assembly]::LoadFrom("C:\mypath\MyAssembly.dll")

Problem is that different formatters are used on the pipeline

if you want the output also format it explicit e.g. | format-list

Greetings /\/\o\/\/

"Patrick Escarcega" <PatrickEscarcega@discussions.microsoft.com> wrote in
message news:246FB9DE-94A5-4810-BA8E-F52501C2DD90@microsoft.com...
> I'm getting the following error when calling either Format-List or
> Format-Table
>
> #(removed actual names)
> [Reflection.Assembly]::LoadFrom("C:\mypath\MyAssembly.dll")
> $s = [MyObject]::ICollection
>
> $s | where {$_.DisplayName -like ("*" + args[0] + "*")} | format-table
> DBID,DisplayName -auto
>
> and this is the error I'm getting
>
> out-lineoutput : Object of Type
> "Microsoft.PowerShell.Commands.Internal.Format.FormatStartData" is not
> legal
> or not in the correct sequence. This is likely caused by a user-specified
> "format-table" command which is conflicting with the default formatting.
>
> This only happens when I'm running this as a PS1 script (file.ps1), when I
> run these commands from the command-line it works fine.
>
> And it's just the format-table command, if I remove that I get what I
> expect, a long list of objects.
>
>


My System SpecsSystem Spec
Old 01-08-2007   #3 (permalink)
/\\/\\o\\/\\/ [MVP]
Guest


 

Re: Format-table error

another thread about it (I think there was a better one with more info,but
can not find it )
this "feature" got me lots of times, as I almost always test by just pasting
the code into the console,

best thing to avoid this is too do hardcode formatting on all output in
scripts


http://groups.google.nl/group/micros...2703b0b605f3f2

Greetings /\/\o\/\/

"/\/\o\/\/ [MVP]" <mow001@hotmail.NoSpam> wrote in message
news:B3123566-072A-4244-A262-8CBD2B617367@microsoft.com...
> try this :
>
> [void] [Reflection.Assembly]::LoadFrom("C:\mypath\MyAssembly.dll")
>
> Problem is that different formatters are used on the pipeline
>
> if you want the output also format it explicit e.g. | format-list
>
> Greetings /\/\o\/\/
>
> "Patrick Escarcega" <PatrickEscarcega@discussions.microsoft.com> wrote in
> message news:246FB9DE-94A5-4810-BA8E-F52501C2DD90@microsoft.com...
>> I'm getting the following error when calling either Format-List or
>> Format-Table
>>
>> #(removed actual names)
>> [Reflection.Assembly]::LoadFrom("C:\mypath\MyAssembly.dll")
>> $s = [MyObject]::ICollection
>>
>> $s | where {$_.DisplayName -like ("*" + args[0] + "*")} | format-table
>> DBID,DisplayName -auto
>>
>> and this is the error I'm getting
>>
>> out-lineoutput : Object of Type
>> "Microsoft.PowerShell.Commands.Internal.Format.FormatStartData" is not
>> legal
>> or not in the correct sequence. This is likely caused by a user-specified
>> "format-table" command which is conflicting with the default formatting.
>>
>> This only happens when I'm running this as a PS1 script (file.ps1), when
>> I
>> run these commands from the command-line it works fine.
>>
>> And it's just the format-table command, if I remove that I get what I
>> expect, a long list of objects.
>>
>>

>


My System SpecsSystem Spec
Old 01-08-2007   #4 (permalink)
Patrick Escarcega
Guest


 

Re: Format-table error

Thanks so much, that worked great, just that little [void] and my script
worked.

It's an unusual error thanks for helping.

"/\/\o\/\/ [MVP]" wrote:

> try this :
>
> [void] [Reflection.Assembly]::LoadFrom("C:\mypath\MyAssembly.dll")
>
> Problem is that different formatters are used on the pipeline
>
> if you want the output also format it explicit e.g. | format-list
>
> Greetings /\/\o\/\/
>
> "Patrick Escarcega" <PatrickEscarcega@discussions.microsoft.com> wrote in
> message news:246FB9DE-94A5-4810-BA8E-F52501C2DD90@microsoft.com...
> > I'm getting the following error when calling either Format-List or
> > Format-Table
> >
> > #(removed actual names)
> > [Reflection.Assembly]::LoadFrom("C:\mypath\MyAssembly.dll")
> > $s = [MyObject]::ICollection
> >
> > $s | where {$_.DisplayName -like ("*" + args[0] + "*")} | format-table
> > DBID,DisplayName -auto
> >
> > and this is the error I'm getting
> >
> > out-lineoutput : Object of Type
> > "Microsoft.PowerShell.Commands.Internal.Format.FormatStartData" is not
> > legal
> > or not in the correct sequence. This is likely caused by a user-specified
> > "format-table" command which is conflicting with the default formatting.
> >
> > This only happens when I'm running this as a PS1 script (file.ps1), when I
> > run these commands from the command-line it works fine.
> >
> > And it's just the format-table command, if I remove that I get what I
> > expect, a long list of objects.
> >
> >

>

My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
RE: How to convert Table-Format Data to CSV-Format? Kiron PowerShell 0 07-25-2008 05:47 PM
RE: How to convert Table-Format Data to CSV-Format? Kiron PowerShell 0 07-25-2008 03:40 PM
RE: How to convert Table-Format Data to CSV-Format? Kiron PowerShell 0 07-25-2008 03:19 PM
Format-table Swamy Channaveera PowerShell 3 03-25-2008 07:09 AM
Format-Table Dave PowerShell 6 08-26-2006 05:28 PM


Update your Vista Drivers Update Your Drivers Now!!

Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008