![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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 | Determining which CMDLETs a pssnapin adds With the release of the PowerShell Community Extensions I have been wanting to provide automatic ways to disover the functionality that comes with it. Let's face it, documentation tends to be static and often isn't up-to-date and/or correct. So I added an alias for the 1.0 alias that will list all of the PSCX created aliases: galpscx This works only because we have adopted a convention of using the "Description" property of Set-Alias and we start each description with "PSCX". So all the galpscx aliases does is expand to a Get-AliasPscx function which does this: Get-Alias | ?{$_.Description -match "^PSCX"} It turns out that each cmdlets indicates which PSSnapIn it is associated with which is way cool e.g.: 22> gcm Set-FileTime | fl * DLL : C:\Program Files\PowerShell Community Extensions\Pscx.dll Verb : Set Noun : FileTime HelpFile : Pscx.dll-Help.xml PSSnapIn : Pscx <snip> Note that you have to specify "fl *" to get the PSSnapIn property to display. Now you can do something like this: 15> gcm -type cmdlet | group PSSnapin | fl * Values : {Microsoft.PowerShell.Management} Count : 47 Group : {Add-Content, Clear-Content, Clear-Item, Clear-ItemProperty, Convert-P ath, Copy-Item, Copy-ItemProperty, Get-ChildItem, Get-Content, Get-Eve ntLog, Get-Item, Get-ItemProperty, Get-Location, Get-Process, Get-PSDr ive, Get-PSProvider, Get-Service, Get-WmiObject, Invoke-Item, Join-Pat h, Move-Item, Move-ItemProperty, New-Item, New-ItemProperty, New-PSDri ve, New-Service, Pop-Location, Push-Location, Remove-Item, Remove-Item Property, Remove-PSDrive, Rename-Item, Rename-ItemProperty, Resolve-Pa th, Restart-Service, Resume-Service, Set-Content, Set-Item, Set-ItemPr operty, Set-Location, Set-Service, Split-Path, Start-Service, Stop-Pro cess, Stop-Service, Suspend-Service, Test-Path} Name : Microsoft.PowerShell.Management <snip> or to see what is in a particular pssnapin: 23> gcm -type cmdlet | ? {$_.PSSnapin -match "^Pscx"} CommandType Name Definition ----------- ---- ---------- Cmdlet ConvertFrom-Base64 ConvertFrom-Base64 [-Base64T... Cmdlet ConvertTo-Base64 ConvertTo-Base64 [-Bytes] <B... Cmdlet ConvertTo-MacOs9LineEnding ConvertTo-MacOs9LineEnding [... Cmdlet ConvertTo-UnixLineEnding ConvertTo-UnixLineEnding [-P... Cmdlet ConvertTo-WindowsLineEnding ConvertTo-WindowsLineEnding ... Cmdlet Convert-Xml Convert-Xml [-Path] <String[... Cmdlet Format-Hex Format-Hex [-Path] <String[]... Cmdlet Format-Xml Format-Xml [-Path] <String[]... Cmdlet Get-Clipboard Get-Clipboard [-Verbose] [-D... Cmdlet Get-CmdletMaml Get-CmdletMaml [-Path] <Stri... Cmdlet Get-ForegroundWindow Get-ForegroundWindow [-Verbo... Cmdlet Get-Hash Get-Hash [-Path] <String[]> ... Cmdlet Get-MountPoint Get-MountPoint [[-Root] <Str... Cmdlet Get-Privilege Get-Privilege [[-Identity] <... Cmdlet Get-ShortPath Get-ShortPath [-Path] <Strin... Cmdlet Join-String Join-String [-Strings] <Stri... Cmdlet New-HardLink New-HardLink [[-FilePath] <S... Cmdlet Out-Clipboard Out-Clipboard [-InputObject]... Cmdlet Remove-MountPoint Remove-MountPoint [[-Name] <... Cmdlet Send-SmtpMail Send-SmtpMail [-SmtpHost <St... Cmdlet Set-FileTime Set-FileTime [-Path] <String... Cmdlet Set-ForegroundWindow Set-ForegroundWindow [[-Hand... Cmdlet Set-VolumeLabel Set-VolumeLabel [[-Path] <St... Cmdlet Split-String Split-String [[-Separator] <... Cmdlet Start-Process Start-Process [[-Path] <Stri... Cmdlet Stop-RemoteDesktop Stop-RemoteDesktop [-Id] <In... Cmdlet Test-Xml Test-Xml [-Path] <String[]> ... Cmdlet Write-Clipboard Write-Clipboard [-Object] <P... For the next version of PSCX I'll be adding a function Get-PSSnapInCmdlet that will take a search pattern for specifying the PSSnapIn as well as an alias gcmpscx that lists all the PSCX provided cmdlets. -- Keith |
My System Specs![]() |
| | #2 (permalink) |
| Guest | RE: Determining which CMDLETs a pssnapin adds Would it be possible for the function to list all the snapins installed and their associated cmdlets as well -- Richard Siddaway Please note that all scripts are supplied "as is" and with no warranty "Keith Hill [MVP]" wrote: > With the release of the PowerShell Community Extensions I have been wanting to provide automatic ways to disover the functionality that comes with it. Let's face it, documentation tends to be static and often isn't up-to-date and/or correct. So I added an alias for the 1.0 alias that will list all of the PSCX created aliases: > > galpscx > > This works only because we have adopted a convention of using the "Description" property of Set-Alias and we start each description with "PSCX". So all the galpscx aliases does is expand to a Get-AliasPscx function which does this: > > Get-Alias | ?{$_.Description -match "^PSCX"} > > It turns out that each cmdlets indicates which PSSnapIn it is associated with which is way cool e.g.: > > 22> gcm Set-FileTime | fl * > > > DLL : C:\Program Files\PowerShell Community Extensions\Pscx.dll > Verb : Set > Noun : FileTime > HelpFile : Pscx.dll-Help.xml > PSSnapIn : Pscx > <snip> > > Note that you have to specify "fl *" to get the PSSnapIn property to display. Now you can do something like this: > > 15> gcm -type cmdlet | group PSSnapin | fl * > > > Values : {Microsoft.PowerShell.Management} > Count : 47 > Group : {Add-Content, Clear-Content, Clear-Item, Clear-ItemProperty, Convert-P > ath, Copy-Item, Copy-ItemProperty, Get-ChildItem, Get-Content, Get-Eve > ntLog, Get-Item, Get-ItemProperty, Get-Location, Get-Process, Get-PSDr > ive, Get-PSProvider, Get-Service, Get-WmiObject, Invoke-Item, Join-Pat > h, Move-Item, Move-ItemProperty, New-Item, New-ItemProperty, New-PSDri > ve, New-Service, Pop-Location, Push-Location, Remove-Item, Remove-Item > Property, Remove-PSDrive, Rename-Item, Rename-ItemProperty, Resolve-Pa > th, Restart-Service, Resume-Service, Set-Content, Set-Item, Set-ItemPr > operty, Set-Location, Set-Service, Split-Path, Start-Service, Stop-Pro > cess, Stop-Service, Suspend-Service, Test-Path} > Name : Microsoft.PowerShell.Management > <snip> > > or to see what is in a particular pssnapin: > > 23> gcm -type cmdlet | ? {$_.PSSnapin -match "^Pscx"} > > CommandType Name Definition > ----------- ---- ---------- > Cmdlet ConvertFrom-Base64 ConvertFrom-Base64 [-Base64T... > Cmdlet ConvertTo-Base64 ConvertTo-Base64 [-Bytes] <B... > Cmdlet ConvertTo-MacOs9LineEnding ConvertTo-MacOs9LineEnding [... > Cmdlet ConvertTo-UnixLineEnding ConvertTo-UnixLineEnding [-P... > Cmdlet ConvertTo-WindowsLineEnding ConvertTo-WindowsLineEnding ... > Cmdlet Convert-Xml Convert-Xml [-Path] <String[... > Cmdlet Format-Hex Format-Hex [-Path] <String[]... > Cmdlet Format-Xml Format-Xml [-Path] <String[]... > Cmdlet Get-Clipboard Get-Clipboard [-Verbose] [-D... > Cmdlet Get-CmdletMaml Get-CmdletMaml [-Path] <Stri... > Cmdlet Get-ForegroundWindow Get-ForegroundWindow [-Verbo... > Cmdlet Get-Hash Get-Hash [-Path] <String[]> ... > Cmdlet Get-MountPoint Get-MountPoint [[-Root] <Str... > Cmdlet Get-Privilege Get-Privilege [[-Identity] <... > Cmdlet Get-ShortPath Get-ShortPath [-Path] <Strin... > Cmdlet Join-String Join-String [-Strings] <Stri... > Cmdlet New-HardLink New-HardLink [[-FilePath] <S... > Cmdlet Out-Clipboard Out-Clipboard [-InputObject]... > Cmdlet Remove-MountPoint Remove-MountPoint [[-Name] <... > Cmdlet Send-SmtpMail Send-SmtpMail [-SmtpHost <St... > Cmdlet Set-FileTime Set-FileTime [-Path] <String... > Cmdlet Set-ForegroundWindow Set-ForegroundWindow [[-Hand... > Cmdlet Set-VolumeLabel Set-VolumeLabel [[-Path] <St... > Cmdlet Split-String Split-String [[-Separator] <... > Cmdlet Start-Process Start-Process [[-Path] <Stri... > Cmdlet Stop-RemoteDesktop Stop-RemoteDesktop [-Id] <In... > Cmdlet Test-Xml Test-Xml [-Path] <String[]> ... > Cmdlet Write-Clipboard Write-Clipboard [-Object] <P... > > For the next version of PSCX I'll be adding a function Get-PSSnapInCmdlet that will take a search pattern for specifying the PSSnapIn as well as an alias gcmpscx that lists all the PSCX provided cmdlets. > > -- > Keith > > > > > > > |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: Determining which CMDLETs a pssnapin adds "RichS" <RichS@discussions.microsoft.com> wrote in message news:A68C9217-D9E2-438A-B14F-49A35C057569@microsoft.com... > Would it be possible for the function to list all the snapins installed > and > their associated cmdlets as well Keith's "gcm -type cmdlet | group pssnapin | fl *" does this, unless you consider there might be a snapin installed which doesn't have any cmdlet associated to it. Then you can take it the other way round: get-pssnapin | select name,@{n="Cmdlets";e={$si=$_;gcm -type cmdlet | ?{$_.pssnapin -eq $si}}} Jacques |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Determining if I have AntiVirus Protection in Vista Home Premium | DDB | Vista security | 0 | 04-11-2008 06:03 PM |
| Determining the path used to call a script | Brillig | PowerShell | 2 | 02-01-2007 04:22 AM |
| Determining if a directory is writeable | Marco Shaw | PowerShell | 7 | 11-23-2006 10:22 PM |
| PSSnapIn class missing | Koko | PowerShell | 1 | 11-19-2006 12:57 PM |
| Determining numeric scope? | Alex K. Angelopoulos [MVP] | PowerShell | 0 | 08-08-2006 10:34 AM |