![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | How can select -first X work, but not select -last X PS C:\> $authors|select -first 10 $_.header.from -------------- "microsoft news" <oevinny@hotmail.com> "v-haos" <v-haos@hotmail.com> "v-haos" <v-haos@hotmail.com> mk display name mk display name "Community User" <oe1@test.com> "bvt2" <bvt2@oeexchange.com> "msnews.microsoft.com" <someone at si-intl.com> PS C:\> $authors|select -last 10 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 defaul t formatting. I don't get it. Can anyone explain? Marco |
My System Specs![]() |
| | #2 (permalink) |
| | Re: How can select -first X work, but not select -last X It works for me with simple arrays and sequences, even if the count is lower than the argument of -Last. Do you see anything suspect if you do this: $authors | get-member And what object types are the members of $author? "Marco Shaw" <marco@Znbnet.nb.ca> wrote in message news:u7jAwriHHHA.3616@TK2MSFTNGP06.phx.gbl... > PS C:\> $authors|select -first 10 > > $_.header.from > -------------- > "microsoft news" <oevinny@hotmail.com> > "v-haos" <v-haos@hotmail.com> > "v-haos" <v-haos@hotmail.com> > mk display name > mk display name > "Community User" <oe1@test.com> > "bvt2" <bvt2@oeexchange.com> > "msnews.microsoft.com" <someone at si-intl.com> > PS C:\> $authors|select -last 10 > 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 defaul > t formatting. > > I don't get it. Can anyone explain? > > Marco > |
My System Specs![]() |
| | #3 (permalink) |
| | Re: How can select -first X work, but not select -last X Any chance you could post where you're getting $authors from? (If it isn't that large that is.) It would make it easier to try to repro. "Marco Shaw" <marco@Znbnet.nb.ca> wrote in message news:u7jAwriHHHA.3616@TK2MSFTNGP06.phx.gbl... > PS C:\> $authors|select -first 10 > > $_.header.from > -------------- > "microsoft news" <oevinny@hotmail.com> > "v-haos" <v-haos@hotmail.com> > "v-haos" <v-haos@hotmail.com> > mk display name > mk display name > "Community User" <oe1@test.com> > "bvt2" <bvt2@oeexchange.com> > "msnews.microsoft.com" <someone at si-intl.com> > PS C:\> $authors|select -last 10 > 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 defaul > t formatting. > > I don't get it. Can anyone explain? > > Marco > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: How can select -first X work, but not select -last X I suspect that $authors was created by: $authors = $somethinghuge | ft @{ e= { $_.headers.from } } In that case, $authors actually stores the output of the formatting, not the objects themselves. If you send formatting records to the host in the wrong order (such as the table end before the table beginning,) you get the error you saw. If you want to filter some properties, you would do: $authors = $somethinghuge | select { $_.headers.from } Although that generates a bunch of objects with just a "$_.headers.from" property. If you want just the authors themselves, you might do: $authors = $somethinghuge | foreach { $_.headers.from } However, you might question why you are dropping the data -- the information you need might be available without having to go through the middle step of filtering. -- Lee Holmes [MSFT] Windows PowerShell Development Microsoft Corporation This posting is provided "AS IS" with no warranties, and confers no rights. "Marcel J. Ortiz [MSFT]" <mosoto@online.microsoft.com> wrote in message news:umGBarjHHHA.1248@TK2MSFTNGP03.phx.gbl... > Any chance you could post where you're getting $authors from? (If it > isn't that large that is.) It would make it easier to try to repro. > > > "Marco Shaw" <marco@Znbnet.nb.ca> wrote in message > news:u7jAwriHHHA.3616@TK2MSFTNGP06.phx.gbl... >> PS C:\> $authors|select -first 10 >> >> $_.header.from >> -------------- >> "microsoft news" <oevinny@hotmail.com> >> "v-haos" <v-haos@hotmail.com> >> "v-haos" <v-haos@hotmail.com> >> mk display name >> mk display name >> "Community User" <oe1@test.com> >> "bvt2" <bvt2@oeexchange.com> >> "msnews.microsoft.com" <someone at si-intl.com> >> PS C:\> $authors|select -last 10 >> 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 defaul >> t formatting. >> >> I don't get it. Can anyone explain? >> >> Marco >> > > |
My System Specs![]() |
| | #5 (permalink) |
| | Re: How can select -first X work, but not select -last X > Do you see anything suspect if you do this: > $authors | get-member > And what object types are the members of $author? |gm was ugly... $authors contains some ugly stuff in the last lines which was likely the issue... <bvt2@oeexchange.com> à,?à,"à,µä,-æ-? <v-haos1@hotmail.com> à,?à,"à,µä,-æ-? "Claus A. Munch" <munchen@disturbed.dk> need.help.please@aol.com ?$B%K%e!<%9?(B "asd" <asdfads@ad> <v-xichen@oeexchange.com> "D@ny" <dany484-news*STOP-SPAM*@yahoo.it> <v-haos1@hotmail.com> <zl991619@hotmail.com> <prcmc07@hotmail.com> <prcmc07@hotmail.com> |
My System Specs![]() |
| | #6 (permalink) |
| | Re: How can select -first X work, but not select -last X OK, how are you generating this? Share. ![]() "Marco Shaw" <marco@Znbnet.nb.ca> wrote in message news:eV95vQlHHHA.1008@TK2MSFTNGP06.phx.gbl... >> Do you see anything suspect if you do this: >> $authors | get-member >> And what object types are the members of $author? > > |gm was ugly... > > $authors contains some ugly stuff in the last lines which was likely the > issue... > > <bvt2@oeexchange.com> > à,?à,"à,µä,-æ-? > <v-haos1@hotmail.com> > à,?à,"à,µä,-æ-? > "Claus A. Munch" <munchen@disturbed.dk> > need.help.please@aol.com > ?$B%K%e!<%9?(B > "asd" <asdfads@ad> > <v-xichen@oeexchange.com> > "D@ny" <dany484-news*STOP-SPAM*@yahoo.it> > <v-haos1@hotmail.com> > <zl991619@hotmail.com> > <prcmc07@hotmail.com> > <prcmc07@hotmail.com> > |
My System Specs![]() |
| | #7 (permalink) |
| | Re: How can select -first X work, but not select -last X "Alex K. Angelopoulos [MVP]" <aka@online.mvps.org> wrote in message news:%23Cwd5crHHHA.4216@TK2MSFTNGP06.phx.gbl... > OK, how are you generating this? Share. ![]() See thread "Loading 3rd party .NET assembly" from Dec 8th. You'll have to install the Smilla NNTP .NET libray. If you're willing to do that, I can provide my code that gets you to the point where I was at. Marco |
My System Specs![]() |
| | #8 (permalink) |
| | Re: How can select -first X work, but not select -last X got it, playing with it a bit, but it obviously takes learning some things to work out my own code. Examples would be wonderful. "Marco Shaw" <marco@Znbnet.nb.ca> wrote in message news:uI0%23RDsHHHA.4896@TK2MSFTNGP04.phx.gbl... > "Alex K. Angelopoulos [MVP]" <aka@online.mvps.org> wrote in message > news:%23Cwd5crHHHA.4216@TK2MSFTNGP06.phx.gbl... >> OK, how are you generating this? Share. ![]() > > See thread "Loading 3rd party .NET assembly" from Dec 8th. You'll have to > install the Smilla NNTP .NET libray. > > If you're willing to do that, I can provide my code that gets you to the > point where I was at. > > Marco > |
My System Specs![]() |
| | #9 (permalink) |
| | Re: How can select -first X work, but not select -last X "Alex K. Angelopoulos [MVP]" <aka@online.mvps.org> wrote in message news:Ooxkqs4HHHA.4688@TK2MSFTNGP04.phx.gbl... > got it, playing with it a bit, but it obviously takes learning some things > to work out my own code. Examples would be wonderful. >> >> See thread "Loading 3rd party .NET assembly" from Dec 8th. You'll have >> to install the Smilla NNTP .NET libray. If you mean examples to get and post, check out the thread where Jacques provides a transcript. (Seems Google news/deja.com won't show his article?!). Also: http://www.smilla.ru/tutorial.html Quickly: $session = new-object smilla.net.nntpclient.session("news.microsoft.com") $group=$session.getnewsgroup("microsoft.public.nntp.test") $articles=$group.getarticles($true) $authors=$articles.getarticlelist()|%{$_.header.from} Hmm.... I think that was the group I queried... a '$authors|select -last 100' doesn't seem to err out anymore. I dunno... |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| select case does not work ... why? | VB Script | |||
| Select Files - Disable or Enable Full Row Select | Tutorials | |||
| Select Certificate message, but no certificate to select | Vista security | |||
| Select Certificate - but nothing to select | Vista General | |||
| Multiple File Select and Select All | Vista file management | |||