Skip to content

Instantly share code, notes, and snippets.

@Araxeus
Created April 20, 2021 11:32
Show Gist options
  • Save Araxeus/51e5f8e1535a01c7b8d56699b5e789f5 to your computer and use it in GitHub Desktop.
Save Araxeus/51e5f8e1535a01c7b8d56699b5e789f5 to your computer and use it in GitHub Desktop.
# Get parameters, examples, full and Online help for a cmdlet or function
# Get a list of all Modules
Get-Module -ListAvailable |
Out-GridView -PassThru -Title 'Available modules'
# Get a list of all functions
Get-Command -CommandType Function |
Out-GridView -PassThru -Title 'Available functions'
# Get a list of all commandlets
Get-Command -CommandType Cmdlet |
Out-GridView -PassThru -Title 'Available cmdlets'
# Get a list of all functions for the specified name
Get-Command -Name '*ADGroup*' -CommandType Function |
Out-GridView -PassThru -Title 'Available named functions'
# Get a list of all commandlets for the specified name
Get-Command -Name '*ADGroup**' -CommandType Cmdlet |
Out-GridView -PassThru -Title 'Available named cmdlet'
# get function / cmdlet details
Get-Command -Name Get-ADUser -Syntax
(Get-Command -Name Get-ADUser).Parameters.Keys
Get-help -Name Get-ADUser -Full
Get-help -Name Get-ADUser -Online
Get-help -Name Get-ADUser -Examples
# Get parameter that accepts pipeline input
Get-Help Get-ADUser -Parameter * |
Where-Object {$_.pipelineInput -match 'true'} |
Select *
# List of all parameters that a given cmdlet supports along with a short description:
Get-Help dir -para * |
Format-Table Name, { $_.Description[0].Text } -wrap
# Find all cmdlets / functions with a target parameter
Get-Command -CommandType Function |
Where-Object { $_.parameters.keys -match 'credential'} |
Out-GridView -PassThru -Title 'Available functions which has a specific parameter'
Get-Command -CommandType Cmdlet |
Where-Object { $_.parameters.keys -match 'credential'} |
Out-GridView -PassThru -Title 'Results for cmdlets which has a specific parameter'
# Get named aliases
Get-Alias |
Out-GridView -PassThru -Title 'Available aliases'
# Get cmdlet / function parameter aliases
(Get-Command Get-ADUser).Parameters.Values |
where aliases |
select Name, Aliases |
Out-GridView -PassThru -Title 'Alias results for a given cmdlet or function.'
### Query Powershell Data Types
[AppDomain]::CurrentDomain.GetAssemblies() |
Foreach-Object { $_.GetExportedTypes() }
# Or
[psobject].Assembly.GetType(“System.Management.Automation.TypeAccelerators”)::get
# Or
[psobject].Assembly.GetType("System.Management.Automation.TypeAccelerators")::Get.GetEnumerator() `
| Sort-Object -Property Key
<#
Get any .NET types and their static methods from PowerShell.
Enumerate all that are currently loaded into your AppDomain.
#>
[AppDomain]::CurrentDomain.GetAssemblies() |
foreach { $_.GetTypes() } |
foreach { $_.GetMethods() } |
where { $_.IsStatic } |
select DeclaringType, Name |
Out-GridView -PassThru -Title '.NET types and their static methods'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment