New-XenObserver

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

Syntax

New-XenObserver -HashTable <hashtable> [-PassThru] [-BestEffort]
    [-SessionOpaqueRef <string>] [-WhatIf] [-Confirm] [-Async] [<CommonParameters>]
New-XenObserver -Record <Observer> [-PassThru] [-BestEffort] [-SessionOpaqueRef <string>]
    [-WhatIf] [-Confirm] [-Async] [<CommonParameters>]
New-XenObserver [-PassThru] [-NameLabel <string>] [-NameDescription <string>]
    [-Hosts <List[XenRef[Host]]>] [-Attributes <hashtable>] [-Endpoints <string[]>]
    [-Components <string[]>] [-Enabled <bool>] [-BestEffort] [-SessionOpaqueRef <string>]
    [-WhatIf] [-Confirm] [-Async] [<CommonParameters>]

Description

Creates a new Observer object.
Observer: Describes an observer which will control observability activity in the Toolstack.

Parameters

-Async

If set, the operation runs asynchronously and returns a Task object that can be used to track its progress.
Attribute Value
Type SwitchParameter
Required False
Position Named
Accepts pipeline input False

-Attributes

Attributes that observer will add to the data they produce
Attribute Value
Type hashtable
Required False
Position Named
Accepts pipeline input False

-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

-Components

The list of xenserver components the observer will broadcast. An empty list means all components
Attribute Value
Type string[]
Required False
Position Named
Accepts pipeline input False

-Confirm

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

-Enabled

This denotes if the observer is enabled. true if it is enabled and false if it is disabled
Attribute Value
Type bool
Required False
Position Named
Accepts pipeline input False

-Endpoints

The list of endpoints where data is exported to. Each endpoint is a URL or the string 'bugtool' refering to the internal logs
Attribute Value
Type string[]
Required False
Position Named
Accepts pipeline input False

-HashTable

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

-Hosts

The list of hosts the observer is active on. An empty list means all hosts
Attribute Value
Type List[XenRef[Host]]
Required False
Position Named
Accepts pipeline input False

-NameDescription

a notes field containing human-readable description
Attribute Value
Type string
Required False
Position Named
Accepts pipeline input False

-NameLabel

a human-readable name
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

-Record

An existing Observer record whose fields are used to create the new object.
Attribute Value
Type Observer
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

  • Observer
  • Task
  • void

Examples

Example 1: Create an Observer from a table of fields

PS> New-XenObserver -HashTable @{ name_label = "Demo Observer" } -PassThru
The keys are the API's field names, so this form reads the same for every class whatever fields it happens to have. -PassThru returns the new Observer.

Example 2: Create an Observer from parameters

PS> New-XenObserver -NameLabel "new value" -PassThru
The same thing with one parameter per field, which is the form that tab-completes. Get-Help New-XenObserver -Full lists them all.

Example 3: Create an Observer from an existing one

PS> $record = Get-XenObserver | Select-Object -First 1
PS> New-XenObserver -Record $record -PassThru
-Record takes a whole Observer record, so an existing object can be used as the template for a new one.