Clear-MsmqQueue

Clears queues.

Syntax

Clear-MsmqQueue
     [-Confirm]
     -InputObject <MessageQueue[]>
     [-WhatIf]
     [<CommonParameters>]

Description

The Clear-MsmqQueue cmdlet clears queues. Specify queues to clear by using MessageQueue objects. This cmdlet returns a MessageQueue object that represents the cleared outgoing queue.

Examples

Example 1: Clear message queues based on name

PS C:\> Get-MsmqQueue -Name "Order*" | Clear-MsmqQueue

This command gets all the message queues that have names that start with the string Order by using the Get-MsmqQueue cmdlet. The command passes the results to the current cmdlet by using the pipeline operator. The current cmdlet clears each queue.

Required Parameters

-InputObject

Specifies an array of MessageQueue objects. This cmdlet clears the queues that the MessageQueue objects specify. This parameter accepts pipeline input.

Type:MessageQueue[]
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False

Optional Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False