# encoding: ascii
# api: powershell
# title: Get-Parameter function
# description: Get a dictionary of parameters for a function or cmdlet, optionally including the common parameters (verbose, debug etc) for functions using cmdletbinding, or ordinary cmdlets.
# version: 0.1
# type: function
# author: Oisin Grehan
# license: CC0
# function: Get-Parameters
# x-poshcode-id: 1053
# x-archived: 2016-03-05T10:54:42
# x-published: 2010-04-22T12:32:00
#
#
function Get-Parameters {
param([string]$CommandName, [switch]$IncludeCommon)
try {
$command = get-command $commandname
$parameters = (new-object System.Management.Automation.CommandMetaData $command, $includecommon).Parameters
$parameters.getenumerator() # unroll dictionary
} catch {
write-warning "Could not find command or obtain parameters for $commandname"
}
}