Move-MsmqMessage
Moves messages between subqueues or between the main queue and a subqueue.
Syntax
Default (Default)
Move-MsmqMessage
-InputObject <MessageQueue>
-DestinationQueue <MessageQueue>
-Message <Message>
[-Transactional]
[<CommonParameters>]
Description
The Move-MsmqMessage cmdlet moves messages between subqueues of the same queue or between the main queue and one of its subqueues. This cmdlet returns a Message object that represents the moved message. Move and open operations implicitly create subqueues. You can get subqueues by using the Get-MsmqQueue cmdlet.
Examples
Example 1: Move a message to a subqueue
PS C:\> $SrcQueue = Get-MsmqQueue -QueueType Private -Name "MyQueue"
PS C:\> $DstQueue = Get-MsmqQueue -QueueType Private -Name "MyQueue" -SubQueue "MySubqueue"
PS C:\> $Message = $SrcQueue | Receive-MsmqQueue -Peek
PS C:\> $SrcQueue | Move-MsmqMessage -DestinationQueue $DstQueue -Message $Message
The first command gets a private queue named MyQueue by using the Get-MsmqQueue cmdlet. The command stores the result in the $SrcQueue variable.
The second command gets a subqueue named MySubqueue by using Get-MsmqQueue. The subqueue belongs to the private queue named MyQueue. The command stores the result in the $DstQueue variable.
The third command uses the Receive-MsmqQueue cmdlet get message from the source queue, and stores it in the $Message variable.
The final command moves the message in $Message from the source queue to the destination queue. The destination queue is a subqueue of MyQueue.
Parameters
-DestinationQueue
Specifies an MsmqQueue object that represents the destination queue to which to move the message. The destination queue can be a subqueue or the main queue.
Parameter properties
| Type: | MessageQueue |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | True |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-InputObject
Specifies an MsmqQueue object. The cmdlet moves the message from the source queue that this parameter specifies. The source queue can be a subqueue or the main queue. This parameter accepts pipeline input.
Parameter properties
| Type: | MessageQueue |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | True |
| Value from pipeline: | True |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-Message
Specifies a Message object that represents the message to move.
Parameter properties
| Type: | Message |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | True |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-Transactional
Indicates that this cmdlet moves the message within a transaction context.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.