Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.


Go Back   Vista Forums > Misc Newsgroups > PowerShell

RB

Vista - Silly question from a newbie!

Reply
 
06-22-2006   #1
Philip Colmer


 
 

Silly question from a newbie!

I'm trying to get to grips with PowerShell and so I'm experimenting with
various bits and pieces. In the process, I do this:

help get-*

which, as I would expect, gives me the synopsis help for all of the commands
that start with "get-". So far, so good. Trouble is, the names aren't in any
particular order so I try piping it to sort:

help get-* | sort -property name

but the sort order doesn't change.

Have I overlooked something obvious?

TIA.

--Philip



My System SpecsSystem Spec
06-22-2006   #2
Wei Wu [MSFT]


 
 

Re: Silly question from a newbie!

"help" is a function, in "help get-* | sort -property name" , there are no
input objects for sort to work on.
PS C:\monad> get-command help -type function -us
param([string]$help); Get-Help $help | Out-Host -paging

Try this:
PS C:\monad> get-help get-* | sort -property name |Out-Host -paging

Name Category
Synopsis
---- --------
--------
Get-Acl Command
Gets the access control list (ACL) associated ...
Get-Alias Command
Returns alias names for Cmdlets
Get-AuthenticodeSignature Command
Gets the signature object associated with a file.
Get-ChildItem Command
Retrieves the child items of the specified loc...
Get-Command Command
Retrieves basic information about a command.
Get-Content Command
The get-content command gets the content from ...
Get-Credential Command
Gets a credential object based on a password
Get-Culture Command
Gets the culture information.
Get-Date Command
Gets current date and time.
Get-EventLog Command
Gets eventlog data for the machine.
Get-ExecutionPolicy Command
Gets the effective execution policy for the cu...
....
--
Wei Wu [MSFT]
Windows PowerShell Team
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.

"Philip Colmer" <pcolmer@nospam.nospam> wrote in message
news:%230DviyglGHA.5044@TK2MSFTNGP02.phx.gbl...
> I'm trying to get to grips with PowerShell and so I'm experimenting with
> various bits and pieces. In the process, I do this:
>
> help get-*
>
> which, as I would expect, gives me the synopsis help for all of the
> commands that start with "get-". So far, so good. Trouble is, the names
> aren't in any particular order so I try piping it to sort:
>
> help get-* | sort -property name
>
> but the sort order doesn't change.
>
> Have I overlooked something obvious?
>
> TIA.
>
> --Philip
>
>



My System SpecsSystem Spec
06-22-2006   #3
DBMwS


 
 

RE: Silly question from a newbie!

"Philip Colmer" wrote:

> I'm trying to get to grips with PowerShell and so I'm experimenting with
> various bits and pieces. In the process, I do this:
>
> help get-*
>
> which, as I would expect, gives me the synopsis help for all of the commands
> that start with "get-". So far, so good. Trouble is, the names aren't in any
> particular order so I try piping it to sort:
>
> help get-* | sort -property name
>
> but the sort order doesn't change.
>
> Have I overlooked something obvious?
>
> TIA.
>
> --Philip
>
>
>


It seemed a bit subtle for a beginner why it wouldn't look like it's not
sorting.
Here is what is happening
1."help get-*" will display paged output on the console(without sending help
object to the next pipeline)
if you look at the definition of "help" function,
[^_^]PS[103]>ls function:/help | select definition | fl
Definition : get-help $args[0] | out-host -paging
definition simply displays the help information on the "host" without
sending it to next pipe
And the result is what you see on the console(unsorted output)
2. As a result of step #1, "sort -property name" will receive no input
object to sort
therefore nothing happens

So here is a workaround for your intention(hmm i kind of assumed it )
[^_^]PS[104]>get-help get-* | sort -property name | more
Name Category Synopsis
---- -------- --------
Get-Acl Command Gets the access
contro...
Get-Alias Command Returns alias names
fo...
*** snip ***
<SPACE> next page; <CR> next line; Q quit
[^_^]PS[105]>

There we are getting the help data through "get-help get-*" and sending the
output
to the next pipeline for "sort-object" to sort. and "more" will "paginate"
the output

My System SpecsSystem Spec
Reply

RB


Thread Tools


Similar Threads for: Silly question from a newbie!
Thread Forum
Silly question about backups Vista General
Silly question Vista Games
all right, silly question Vista General
Silly question! Vista account administration
Silly question... Vista General


Vista Forums 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 Ltd