Send-MsmqQueue

Sends a test message to remote queues.

Syntax

Send-MsmqQueue
    [-Name] <String>
    [-MessageObject <Message>]
    [-Body <Object>]
    [-Label <String>]
    [-Recoverable]
    [-Authenticated]
    [-Journaling]
    [-Transactional]
    [-AcknowledgeType <AcknowledgeTypes>]
    [-AdminQueuePath <String>]
    [-ResponseQueuePath <String>]
    [-TimeToReachQueue <TimeSpan>]
    [-TimeToBeReceived <TimeSpan>]
    [<CommonParameters>]
Send-MsmqQueue
    -InputObject <MessageQueue[]>
    [-MessageObject <Message>]
    [-Body <Object>]
    [-Label <String>]
    [-Recoverable]
    [-Authenticated]
    [-Journaling]
    [-Transactional]
    [-AcknowledgeType <AcknowledgeTypes>]
    [-AdminQueuePath <String>]
    [-ResponseQueuePath <String>]
    [-TimeToReachQueue <TimeSpan>]
    [-TimeToBeReceived <TimeSpan>]
    [<CommonParameters>]

Description

The Send-MsmqQueue cmdlet sends a test message to one or more remote queues. 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. By default, this cmdlet sends express messages. It returns a System.Messaging.Message object that represents the message sent.

Examples

Example 1: Send a test message to a queue

PS C:\> Get-MsmqQueue -Name "a04bm10\private$\order_queue" | Send-MsmqQueue -AdminQueuePath ".\private$\admin_queue" -Recoverable -Transactional

This command gets a queue that has the specified name by using the Get-MsmqQueue cmdlet. The command passes the results to the current cmdlet by using the pipeline operator. The current cmdlet sends a test message to the queue. The cmdlet specifies properties of the message.

Example 2: Send a test message with a label to a queue

PS C:\> Get-MsmqQueue -Name "FormatName:DIRECT=TCP:10.199.37.61\order_queue" | Send-MsmqQueue -Label "From PowerShell" -Transactional

This command gets a queue that has the specified name by using Get-MsmqQueue. The command passes the results to the current cmdlet by using the pipeline operator. The current cmdlet sends a test message to the queue. The test message has a label.

Parameters

-AcknowledgeType

Specifies the type of acknowledgement messages that can be returned by Messaging Queuing.

Type:AcknowledgeTypes
Accepted values:None, PositiveArrival, PositiveReceive, NotAcknowledgeReachQueue, FullReachQueue, NegativeReceive, NotAcknowledgeReceive, FullReceive
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-AdminQueuePath

Specifies a path. The queue that the path specifies receives the acknowledgement messages that Message Queuing generates.

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

-Authenticated

Indicates that the cmdlet sends the message as an authenticated message.

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

-Body

Specifies the body of the message. The cmdlet sends a message that includes the body that this parameter specifies to the queue.

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

-InputObject

Specifies an array of MessageQueue objects. This cmdlet sends messages to the destination queues that the MessageQueue specify. This parameter accepts pipeline input.

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

-Journaling

Indicates that the originating computer keeps a copy of the message in a journal.

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

-Label

Specifies a label. The label that this parameter specifies describes the message. The default value is an empty string.

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

-MessageObject

Specifies a preconstructed message object that you can specify as pipeline input.

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

-Name

Specifies a name.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Recoverable

Indicates that the cmdlet sends the message as a recoverable message.

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

-ResponseQueuePath

Specifies a path. The queue that this parameter specifies receives application-generated response messages.

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

-TimeToBeReceived

Specifies the maximum amount of time, in milliseconds, for the message to be received from the destination queue. The default value is 49.17:02:47.295.

Type:TimeSpan
Aliases:TTBR
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TimeToReachQueue

Specifies the maximum amount of time, in milliseconds, for the message to reach the queue. The default value is 49.17:02:47.295.

Type:TimeSpan
Aliases:TTRQ
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Transactional

Indicates that this cmdlet sends the message as a transactional message.

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

Inputs

Microsoft.Msmq.PowerShell.Commands.MessageQueue[]

Outputs

Object