![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| 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 Specs![]() |
| | #2 (permalink) |
| 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 Specs![]() |
| | #3 (permalink) |
| 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 Specs![]() |
| | #4 (permalink) |
| 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 Specs![]() |
![]() |
| 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 |