PowerTip: Check Syntax Options for PowerShell Cmdlet

Summary: Use the Get-Command cmdlet to check syntax options for a Windows PowerShell cmdlet.

  How can I easily find syntax options (parameter sets) that exist for a particular Windows PowerShell cmdlet?

  Use the Get-Command cmdlet and check the Definition property, for example:

(Get-Command Stop-Process).Definition


Comments (4)

  1. Greg Wojan says:

    Get-CASMailbox is a function — that’s why (Get-Command xxx).Definition results in what you see.

  2. Bjorn Houben says:

    Hmmm, didn’t know that one. I generally use: (Get-Help Stop-Process).syntax
    Because it’s easier to remember for me.

  3. shaik says:

    I have run this for (get-command get-casmailbox).definition , this is exchange command and I have done in Exchange management shell

    but I got this , let me know if this is expected if so why and how to fix

    PS C:windowssystem32> (Get-Command Get-CASMailbox).Definition


























    Begin {
    try {
    $positionalArguments = & $script:NewObject collections.arraylist
    foreach ($parameterName in $PSBoundParameters.BoundPositionally)
    $null = $positionalArguments.Add( $PSBoundParameters[$parameterName] )
    $null = $PSBoundParameters.Remove($parameterName)

    $clientSideParameters = Get-PSImplicitRemotingClientSideParameters $PSBoundParameters $True

    $scriptCmd = { & $script:InvokeCommand `
    @clientSideParameters `
    -HideComputerName `
    -Session (Get-PSImplicitRemotingSession -CommandName ‘Get-CASMailbox’) `
    -Arg (‘Get-CASMailbox’, $PSBoundParameters, $positionalArguments) `
    -Script { param($name, $boundParams, $unboundParams) & $name @boundParams @unboundParams } `

    $steppablePipeline = $scriptCmd.GetSteppablePipeline($myInvocation.CommandOrigin)
    $steppablePipeline.Begin($myInvocation.ExpectingInput, $ExecutionContext)
    } catch {
    Process {
    try {
    } catch {
    End {
    try {
    } catch {

    # .ForwardHelpTargetName Get-CASMailbox
    # .ForwardHelpCategory Function
    # .RemoteHelpRunspace PSSession

  4. shaik says:

    Thanks for the reply.

Skip to main content