New-XenMessage

Last published : Nov 12, 2026
Creates a new Message object.

Syntax

New-XenMessage -HashTable <hashtable> [-PassThru] [-BestEffort]
    [-SessionOpaqueRef <string>] [-WhatIf] [-Confirm] [<CommonParameters>]
New-XenMessage -Record <Message> [-PassThru] [-BestEffort] [-SessionOpaqueRef <string>]
    [-WhatIf] [-Confirm] [<CommonParameters>]
New-XenMessage [-PassThru] [-Name <string>] [-Priority <long>]
    [-Cls {VM | Host | SR | Pool | VMPP | VMSS | PVS_proxy | VDI | Certificate | unknown}]
    [-ObjUuid <string>] [-Body <string>] [-BestEffort] [-SessionOpaqueRef <string>]
    [-WhatIf] [-Confirm] [<CommonParameters>]

Description

Creates a new Message object.
Message: A message for the attention of the administrator.

Parameters

-BestEffort

If set, the cmdlet continues processing further objects instead of throwing a terminating error when an operation fails for one object.
Attribute Value
Type SwitchParameter
Required False
Position Named
Accepts pipeline input False

-Body

The body of the message
Attribute Value
Type string
Required False
Position Named
Accepts pipeline input False

-Cls

The class of object this message is associated with
Attribute Value
Type cls
Required False
Position Named
Accepts pipeline input False
Accepted values VM, Host, SR, Pool, VMPP, VMSS, PVS_proxy, VDI, Certificate, unknown

-Confirm

Prompts for confirmation before running the cmdlet.
Attribute Value
Type SwitchParameter
Required False
Position Named
Accepts pipeline input False
Aliases cf

-HashTable

A hashtable of field names to values, from which to create the Message.
Attribute Value
Type hashtable
Required True
Position Named
Accepts pipeline input False

-Name

The name of the message
Attribute Value
Type string
Required False
Position Named
Accepts pipeline input False

-ObjUuid

The uuid of the object this message is associated with
Attribute Value
Type string
Required False
Position Named
Accepts pipeline input False

-PassThru

If set, the cmdlet returns the affected object. By default the cmdlet does not generate any output.
Attribute Value
Type SwitchParameter
Required False
Position Named
Accepts pipeline input False

-Priority

The priority of the message
Attribute Value
Type long
Required False
Position Named
Accepts pipeline input False

-Record

An existing Message record whose fields are used to create the new object.
Attribute Value
Type Message
Required True
Position Named
Accepts pipeline input False

-SessionOpaqueRef

The session object on which to run the cmdlet. This overrides the default session and lets you target a specific open XenServer connection.
Attribute Value
Type string
Required False
Position Named
Accepts pipeline input False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.
Attribute Value
Type SwitchParameter
Required False
Position Named
Accepts pipeline input False
Aliases wi

Inputs

  • None

Outputs

  • Message
  • void

Examples

Example 1: Create a Message

PS> New-XenMessage -Name "value" -Priority 0 -Cls VM -ObjUuid "value" -Body "value" -PassThru
New-XenMessage takes the arguments of the create call rather than a record of fields, and needs all of them. -PassThru returns the new Message.

Example 2: See what would be created

PS> New-XenMessage -Name "value" -Priority 0 -Cls VM -ObjUuid "value" -Body "value" -WhatIf
Reports what would be created without creating it. Every cmdlet that changes the server takes -WhatIf and -Confirm.

Example 3: Run against a particular session

PS> New-XenMessage -Name "value" -Priority 0 -Cls VM -ObjUuid "value" -Body "value" -PassThru -SessionOpaqueRef $session.opaque_ref
Every cmdlet takes -SessionOpaqueRef, which runs it against a session opened with Connect-XenServer rather than the default one. It is how a script drives more than one server at a time.