Skip to content

Latest commit

 

History

History
133 lines (100 loc) · 3.74 KB

Move-MsmqMessage.md

File metadata and controls

133 lines (100 loc) · 3.74 KB
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
Move-MsmqMessage

Move-MsmqMessage

SYNOPSIS

Moves messages between subqueues or between the main queue and a subqueue.

SYNTAX

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.

Type: MessageQueue
Parameter Sets: (All)
Aliases: 

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: 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.

Type: MessageQueue
Parameter Sets: (All)
Aliases: 

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-Message

Specifies a Message object that represents the message to move.

Type: Message
Parameter Sets: (All)
Aliases: 

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Transactional

Indicates that this cmdlet moves the message within a transaction context.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: 

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES

RELATED LINKS

Get-MsmqQueue

New-MsmqMessage

Receive-MsmqQueue