description | external help file | Module Name | ms.date | online version | schema | title |
---|---|---|---|---|---|---|
Use this topic to help manage Windows and Windows Server technologies with Windows PowerShell. |
Microsoft.Msmq.PowerShell.Commands.dll-Help.xml |
MSMQ |
12/27/2016 |
2.0.0 |
Receive-MsmqQueue |
Does a destructive read from a queue.
Receive-MsmqQueue -InputObject <MessageQueue> [-Transactional] [-RetrieveBody] [-Timeout <TimeSpan>]
[-Count <Int32>] [<CommonParameters>]
Receive-MsmqQueue -InputObject <MessageQueue> [-Peek] [-RetrieveBody] [-Timeout <TimeSpan>] [-Count <Int32>]
[<CommonParameters>]
The Receive-MsmqQueue cmdlet does a destructive read from a queue. The cmdlet returns the received System.Messaging.Message object. This cmdlet accepts values for the Name parameter of path names, format names, and direct format names. Some other Message Queuing (also known as MSMQ) cmdlets require a friendly name for the queue. If you specify the Peek parameter, the cmdlet peeks at the message instead of doing a destructive read. The cmdlet succeeds if it returns at least one message.
If you specify the Peek parameter, this cmdlet returns the number of messages that is the minimum of the number supplied by the Count parameter and the number of messages in the queue.
PS C:\> Get-MsmqQueue -Name "a04bm10\private$\order_queue" | Receive-MsmqQueue -Transactional
This command gets the specified queue by using the Get-MsmqQueue cmdlet. The command passes the result to the current cmdlet by using the pipeline operator. The current cmdlet performs a transacted read on the queue.
Specifies the number of messages to be returned. The default value is 1. You must specify a value larger than 0.
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies a MessageQueue object. The cmdlet reads from the queue that the MessageQueue specifies. This parameter accepts pipeline input.
Type: MessageQueue
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Indicates that this cmdlet returns a copy of the first message in the queue without removing the message from the queue.
Type: SwitchParameter
Parameter Sets: Peek
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Indicates that this cmdlet returns the body of the message.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies the maximum time, in milliseconds, to wait for the queue to contain a message. The default value is 0.
Type: TimeSpan
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Indicates that the cmdlet performs a transacted receive.
Type: SwitchParameter
Parameter Sets: Transactional
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug
, -ErrorAction
, -ErrorVariable
, -InformationAction
, -InformationVariable
, -OutVariable
, -OutBuffer
, -PipelineVariable
, -Verbose
, -WarningAction
, and -WarningVariable
. For more information, see about_CommonParameters