Invoke-XenHost

Last published : Nov 12, 2026
Invokes an operation on a Host object.

Syntax

Invoke-XenHost [-XenHost] <Host>
    -XenAction {Disable | Enable | Shutdown | Reboot | Dmesg | DmesgClear | SendDebugKeys | BugreportUpload | ListMethods | LicenseApply | LicenseAdd | LicenseRemove | PowerOn | EmergencyHaDisable | RecordDataSource | QueryDataSource | ForgetDataSourceArchives | AssertCanEvacuate | Evacuate | SyslogReconfigure | ManagementReconfigure | LocalManagementReconfigure | ManagementDisable | RestartAgent | ShutdownAgent | ComputeFreeMemory | ComputeMemoryOverhead | SyncData | BackupRrds | CreateNewBlob | CallPlugin | HasExtension | CallExtension | EnableExternalAuth | DisableExternalAuth | ExternalAuthSetLdaps | RetrieveWlbEvacuateRecommendations | RefreshServerCertificate | InstallServerCertificate | EmergencyResetServerCertificate | ResetServerCertificate | ApplyEdition | RefreshPackInfo | ResetCpuFeatures | EnableLocalStorageCaching | DisableLocalStorageCaching | MigrateReceive | DeclareDead | EnableDisplay | DisableDisplay | EmergencyDisableTlsVerification | EmergencyReenableTlsVerification | ApplyUpdates | RescanDrivers | ApplyRecommendedGuidances | EmergencyClearMandatoryGuidance | EnableSsh | DisableSsh | ListTimezones}
    [-PassThru] [-BestEffort] [-SessionOpaqueRef <string>] [-WhatIf] [-Confirm] [-Async]
    [<CommonParameters>]
Invoke-XenHost [-Ref] <XenRef[Host]>
    -XenAction {Disable | Enable | Shutdown | Reboot | Dmesg | DmesgClear | SendDebugKeys | BugreportUpload | ListMethods | LicenseApply | LicenseAdd | LicenseRemove | PowerOn | EmergencyHaDisable | RecordDataSource | QueryDataSource | ForgetDataSourceArchives | AssertCanEvacuate | Evacuate | SyslogReconfigure | ManagementReconfigure | LocalManagementReconfigure | ManagementDisable | RestartAgent | ShutdownAgent | ComputeFreeMemory | ComputeMemoryOverhead | SyncData | BackupRrds | CreateNewBlob | CallPlugin | HasExtension | CallExtension | EnableExternalAuth | DisableExternalAuth | ExternalAuthSetLdaps | RetrieveWlbEvacuateRecommendations | RefreshServerCertificate | InstallServerCertificate | EmergencyResetServerCertificate | ResetServerCertificate | ApplyEdition | RefreshPackInfo | ResetCpuFeatures | EnableLocalStorageCaching | DisableLocalStorageCaching | MigrateReceive | DeclareDead | EnableDisplay | DisableDisplay | EmergencyDisableTlsVerification | EmergencyReenableTlsVerification | ApplyUpdates | RescanDrivers | ApplyRecommendedGuidances | EmergencyClearMandatoryGuidance | EnableSsh | DisableSsh | ListTimezones}
    [-PassThru] [-BestEffort] [-SessionOpaqueRef <string>] [-WhatIf] [-Confirm] [-Async]
    [<CommonParameters>]
Invoke-XenHost [-Uuid] <guid>
    -XenAction {Disable | Enable | Shutdown | Reboot | Dmesg | DmesgClear | SendDebugKeys | BugreportUpload | ListMethods | LicenseApply | LicenseAdd | LicenseRemove | PowerOn | EmergencyHaDisable | RecordDataSource | QueryDataSource | ForgetDataSourceArchives | AssertCanEvacuate | Evacuate | SyslogReconfigure | ManagementReconfigure | LocalManagementReconfigure | ManagementDisable | RestartAgent | ShutdownAgent | ComputeFreeMemory | ComputeMemoryOverhead | SyncData | BackupRrds | CreateNewBlob | CallPlugin | HasExtension | CallExtension | EnableExternalAuth | DisableExternalAuth | ExternalAuthSetLdaps | RetrieveWlbEvacuateRecommendations | RefreshServerCertificate | InstallServerCertificate | EmergencyResetServerCertificate | ResetServerCertificate | ApplyEdition | RefreshPackInfo | ResetCpuFeatures | EnableLocalStorageCaching | DisableLocalStorageCaching | MigrateReceive | DeclareDead | EnableDisplay | DisableDisplay | EmergencyDisableTlsVerification | EmergencyReenableTlsVerification | ApplyUpdates | RescanDrivers | ApplyRecommendedGuidances | EmergencyClearMandatoryGuidance | EnableSsh | DisableSsh | ListTimezones}
    [-PassThru] [-BestEffort] [-SessionOpaqueRef <string>] [-WhatIf] [-Confirm] [-Async]
    [<CommonParameters>]
Invoke-XenHost [-Name] <string>
    -XenAction {Disable | Enable | Shutdown | Reboot | Dmesg | DmesgClear | SendDebugKeys | BugreportUpload | ListMethods | LicenseApply | LicenseAdd | LicenseRemove | PowerOn | EmergencyHaDisable | RecordDataSource | QueryDataSource | ForgetDataSourceArchives | AssertCanEvacuate | Evacuate | SyslogReconfigure | ManagementReconfigure | LocalManagementReconfigure | ManagementDisable | RestartAgent | ShutdownAgent | ComputeFreeMemory | ComputeMemoryOverhead | SyncData | BackupRrds | CreateNewBlob | CallPlugin | HasExtension | CallExtension | EnableExternalAuth | DisableExternalAuth | ExternalAuthSetLdaps | RetrieveWlbEvacuateRecommendations | RefreshServerCertificate | InstallServerCertificate | EmergencyResetServerCertificate | ResetServerCertificate | ApplyEdition | RefreshPackInfo | ResetCpuFeatures | EnableLocalStorageCaching | DisableLocalStorageCaching | MigrateReceive | DeclareDead | EnableDisplay | DisableDisplay | EmergencyDisableTlsVerification | EmergencyReenableTlsVerification | ApplyUpdates | RescanDrivers | ApplyRecommendedGuidances | EmergencyClearMandatoryGuidance | EnableSsh | DisableSsh | ListTimezones}
    [-PassThru] [-BestEffort] [-SessionOpaqueRef <string>] [-WhatIf] [-Confirm] [-Async]
    [<CommonParameters>]

Description

Invokes an operation on a Host object. Use the -XenAction parameter to select which operation to perform.
Disable: Puts the host into a state in which no new VMs can be started. Currently active VMs on the host continue to execute.
Enable: Puts the host into a state in which new VMs can be started.
Shutdown: Shutdown the host. (This function can only be called if there are no currently running VMs on the host and it is disabled.).
Reboot: Reboot the host. (This function can only be called if there are no currently running VMs on the host and it is disabled.).
Dmesg: Get the host xen dmesg.
DmesgClear: Get the host xen dmesg, and clear the buffer.
SendDebugKeys: Inject the given string as debugging keys into Xen.
BugreportUpload: Run xen-bugtool --yestoall and upload the output to support.
ListMethods: List all supported methods.
LicenseApply: Apply a new license to a host. (Removed.)
LicenseAdd: Apply a new license to a host.
LicenseRemove: Remove any license file from the specified host, and switch that host to the unlicensed edition.
PowerOn: Attempt to power-on the host (if the capability exists).
EmergencyHaDisable: This call disables HA on the local host. This should only be used with extreme care.
RecordDataSource: Start recording the specified data source.
QueryDataSource: Query the latest value of the specified data source.
ForgetDataSourceArchives: Forget the recorded statistics related to the specified data source.
AssertCanEvacuate: Check this host can be evacuated.
Evacuate: Migrate all VMs off of this host, where possible.
SyslogReconfigure: Re-configure syslog logging.
ManagementReconfigure: Reconfigure the management network interface.
LocalManagementReconfigure: Reconfigure the management network interface. Should only be used if Host.management\_reconfigure is impossible because the network configuration is broken.
ManagementDisable: Disable the management network interface.
RestartAgent: Restarts the agent after a 10 second pause. WARNING: this is a dangerous operation. Any operations in progress will be aborted, and unrecoverable data loss may occur. The caller is responsible for ensuring that there are no operations in progress when this method is called.
ShutdownAgent: Shuts the agent down after a 10 second pause. WARNING: this is a dangerous operation. Any operations in progress will be aborted, and unrecoverable data loss may occur. The caller is responsible for ensuring that there are no operations in progress when this method is called.
ComputeFreeMemory: Computes the amount of free memory on the host.
ComputeMemoryOverhead: Computes the virtualization memory overhead of a host.
SyncData: This causes the non-database data (messages, RRDs and so on) stored on the coordinator to be synchronised with the host.
BackupRrds: This causes the RRDs to be backed up to the coordinator.
CreateNewBlob: Create a placeholder for a named binary blob of data that is associated with this host.
CallPlugin: Call an API plugin on this host.
HasExtension: Return true if the extension is available on the host.
CallExtension: Call an API extension on this host.
EnableExternalAuth: This call enables external authentication on a host.
DisableExternalAuth: This call disables external authentication on the local host.
ExternalAuthSetLdaps: This call enables or disables LDAPS for external authentication on the host.
RetrieveWlbEvacuateRecommendations: Retrieves recommended host migrations to perform when evacuating the host from the wlb server. If a VM cannot be migrated from the host the reason is listed instead of a recommendation.
RefreshServerCertificate: Replace the internal self-signed host certficate with a new one.
InstallServerCertificate: Install the TLS server certificate.
EmergencyResetServerCertificate: Delete the current TLS server certificate and replace by a new, self-signed one. This should only be used with extreme care.
ResetServerCertificate: Delete the current TLS server certificate and replace by a new, self-signed one. This should only be used with extreme care.
ApplyEdition: Change to another edition, or reactivate the current edition after a license has expired. This may be subject to the successful checkout of an appropriate license.
RefreshPackInfo: Refresh the list of installed Supplemental Packs. (Deprecated.)
ResetCpuFeatures: Remove the feature mask, such that after a reboot all features of the CPU are enabled. (Removed.)
EnableLocalStorageCaching: Enable the use of a local SR for caching purposes.
DisableLocalStorageCaching: Disable the use of a local SR for caching purposes.
MigrateReceive: Prepare to receive a VM, returning a token which can be passed to VM.migrate.
DeclareDead: Declare that a host is dead. This is a dangerous operation, and should only be called if the administrator is absolutely sure the host is definitely dead.
EnableDisplay: Enable console output to the physical display device next time this host boots.
DisableDisplay: Disable console output to the physical display device next time this host boots.
EmergencyDisableTlsVerification: Disable TLS verification for this host only.
EmergencyReenableTlsVerification: Reenable TLS verification for this host only, and only after it was emergency disabled.
ApplyUpdates: Apply updates from current enabled repository on a host.
RescanDrivers: Scan the host and update its driver information.
ApplyRecommendedGuidances: Apply all recommended guidances both on the host and on all HVM VMs on the host after updates are applied on the host. (Removed.)
EmergencyClearMandatoryGuidance: Clear the pending mandatory guidance on this host.
EnableSsh: Enable SSH access on the host. It will start the service sshd only if it is not running. It will also enable the service sshd only if it is not enabled. A newly joined host in the pool or an ejected host from the pool would keep the original status.
DisableSsh: Disable SSH access on the host. It will stop the service sshd only if it is running. It will also disable the service sshd only if it is enabled. A newly joined host in the pool or an ejected host from the pool would keep the original status.
ListTimezones: List all available timezones on the host.

Parameters

-Args

Arguments for the function. Accepted when -XenAction is CallPlugin.
Attribute Value
Type hashtable
Required False
Position Named
Accepts pipeline input False

-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

-AuthType

The type of authentication (for example, AD for Active Directory). Accepted when -XenAction is EnableExternalAuth.
Attribute Value
Type string
Required False
Position Named
Accepts pipeline input False

-AutoEnable

If true (default), the host will be re-enabled after a toolstack restart automatically. If false, the host will be disabled indefinitely, across toolstack restarts and host reboots, until re-enabled explicitly with Host.enable. Accepted when -XenAction is Disable.
Attribute Value
Type bool
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

-Call

Rpc call for the extension. Accepted when -XenAction is CallExtension.
Attribute Value
Type string
Required False
Position Named
Accepts pipeline input False

-Certificate

The server certificate, in PEM form. Accepted when -XenAction is InstallServerCertificate.
Attribute Value
Type string
Required False
Position Named
Accepts pipeline input False

-CertificateChain

The certificate chain, in PEM form. Accepted when -XenAction is InstallServerCertificate.
Attribute Value
Type string
Required False
Position Named
Accepts pipeline input False

-Config

A list of key-values containing the configuration data. Accepted when -XenAction is EnableExternalAuth, DisableExternalAuth.
Attribute Value
Type hashtable
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

-Contents

The contents of the license file, base64 encoded. Accepted when -XenAction is LicenseApply, LicenseAdd.
Attribute Value
Type string
Required False
Position Named
Accepts pipeline input False

-DataSource

The data source to record. Accepted when -XenAction is RecordDataSource, QueryDataSource, ForgetDataSourceArchives.
Attribute Value
Type string
Required False
Position Named
Accepts pipeline input False

-Delay

Delay in seconds from when the call is received to perform the backup. Accepted when -XenAction is BackupRrds.
Attribute Value
Type double
Required False
Position Named
Accepts pipeline input False

-Edition

The requested edition. Accepted when -XenAction is ApplyEdition.
Attribute Value
Type string
Required False
Position Named
Accepts pipeline input False

-EvacuateBatchSize

The maximum number of VMs to be migrated per batch 0 will use the value \`evacuation-batch-size\` defined in xapi.conf. Accepted when -XenAction is Evacuate.
Attribute Value
Type long
Required False
Position Named
Accepts pipeline input False

-Fn

The name of the function within the plugin. Accepted when -XenAction is CallPlugin.
Attribute Value
Type string
Required False
Position Named
Accepts pipeline input False

-Force

Disable external auth even when not enabled. Accepted when -XenAction is DisableExternalAuth, ExternalAuthSetLdaps, ApplyEdition.
Attribute Value
Type bool
Required False
Position Named
Accepts pipeline input False

-Hash

The hash of updateinfo to be applied which is returned by previous pool.sync\_udpates. Accepted when -XenAction is ApplyUpdates.
Attribute Value
Type string
Required False
Position Named
Accepts pipeline input False

-Interface

name of the interface to use as a management interface. Accepted when -XenAction is LocalManagementReconfigure.
Attribute Value
Type string
Required False
Position Named
Accepts pipeline input False

-Keys

The keys to send. Accepted when -XenAction is SendDebugKeys.
Attribute Value
Type string
Required False
Position Named
Accepts pipeline input False

-Ldaps

Whether to enable or disable LDAPS. Accepted when -XenAction is ExternalAuthSetLdaps.
Attribute Value
Type bool
Required False
Position Named
Accepts pipeline input False

-MimeType

The mime type for the data. Empty string translates to application/octet-stream. Accepted when -XenAction is CreateNewBlob.
Attribute Value
Type string
Required False
Position Named
Accepts pipeline input False

-Name

The name of the Host to operate on.
Attribute Value
Type string
Required True
Position 0
Accepts pipeline input True (ByPropertyName)
Aliases name_label

-NameParam

The name associated with the blob. Accepted when -XenAction is CreateNewBlob, HasExtension.
Attribute Value
Type string
Required False
Position Named
Accepts pipeline input False

-Network

Optional preferred network for migration. Accepted when -XenAction is Evacuate, MigrateReceive.
Attribute Value
Type XenRef[Network]
Required False
Position Named
Accepts pipeline input False

-Options

Extra configuration operations. Accepted when -XenAction is BugreportUpload, MigrateReceive.
Attribute Value
Type hashtable
Required False
Position Named
Accepts pipeline input False

-PIF

reference to a PIF object corresponding to the management interface. Accepted when -XenAction is ManagementReconfigure.
Attribute Value
Type XenRef[PIF]
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

-Plugin

The name of the plugin. Accepted when -XenAction is CallPlugin.
Attribute Value
Type string
Required False
Position Named
Accepts pipeline input False

-PrivateKey

The unencrypted private key used to sign the certificate, in PKCS#8 form. Accepted when -XenAction is InstallServerCertificate.
Attribute Value
Type string
Required False
Position Named
Accepts pipeline input False

-Public

True if the blob should be publicly available. Accepted when -XenAction is CreateNewBlob.
Attribute Value
Type bool
Required False
Position Named
Accepts pipeline input False

-Ref

The Host object to operate on, specified by its opaque reference.
Attribute Value
Type XenRef[Host]
Required True
Position 0
Accepts pipeline input True (ByPropertyName)
Aliases opaque_ref

-SR

The SR to use as a local cache. Accepted when -XenAction is EnableLocalStorageCaching.
Attribute Value
Type XenRef[SR]
Required False
Position Named
Accepts pipeline input False

-ServiceName

The name of the service. Accepted when -XenAction is EnableExternalAuth.
Attribute Value
Type string
Required False
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

-Soft

Disable HA temporarily, revert upon host reboot or further changes, idempotent. Accepted when -XenAction is EmergencyHaDisable.
Attribute Value
Type bool
Required False
Position Named
Accepts pipeline input False

-Url

The URL to upload to. Accepted when -XenAction is BugreportUpload.
Attribute Value
Type string
Required False
Position Named
Accepts pipeline input False

-Uuid

The UUID of the Host to operate on.
Attribute Value
Type guid
Required True
Position 0
Accepts pipeline input True (ByPropertyName)

-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

-XenAction

Selects which action to use.
Attribute Value
Type XenHostAction
Required True
Position Named
Accepts pipeline input False
Accepted values Disable, Enable, Shutdown, Reboot, Dmesg, DmesgClear, SendDebugKeys, BugreportUpload, ListMethods, LicenseApply, LicenseAdd, LicenseRemove, PowerOn, EmergencyHaDisable, RecordDataSource, QueryDataSource, ForgetDataSourceArchives, AssertCanEvacuate, Evacuate, SyslogReconfigure, ManagementReconfigure, LocalManagementReconfigure, ManagementDisable, RestartAgent, ShutdownAgent, ComputeFreeMemory, ComputeMemoryOverhead, SyncData, BackupRrds, CreateNewBlob, CallPlugin, HasExtension, CallExtension, EnableExternalAuth, DisableExternalAuth, ExternalAuthSetLdaps, RetrieveWlbEvacuateRecommendations, RefreshServerCertificate, InstallServerCertificate, EmergencyResetServerCertificate, ResetServerCertificate, ApplyEdition, RefreshPackInfo, ResetCpuFeatures, EnableLocalStorageCaching, DisableLocalStorageCaching, MigrateReceive, DeclareDead, EnableDisplay, DisableDisplay, EmergencyDisableTlsVerification, EmergencyReenableTlsVerification, ApplyUpdates, RescanDrivers, ApplyRecommendedGuidances, EmergencyClearMandatoryGuidance, EnableSsh, DisableSsh, ListTimezones

-XenHost

The Host object to operate on.
Attribute Value
Type Host
Required True
Position 0
Accepts pipeline input True (ByValue)

Inputs

  • Host
  • XenRef[Host]
  • guid
  • string

Outputs

  • System.Object

Examples

Example 1: Run the ListMethods operation

PS> Get-XenHost -Name "Demo Host" | Invoke-XenHost -XenAction ListMethods -PassThru
Invokes the ListMethods operation on a Host. -PassThru writes the result to the pipeline.

Example 2: Put a host into maintenance mode

PS> $h = Get-XenHost -Name "host-02"
PS> $h | Invoke-XenHost -XenAction Disable
PS> $h | Invoke-XenHost -XenAction Evacuate
PS> $h | Invoke-XenHost -XenAction Enable
Disable stops new VMs starting on the host, Evacuate migrates the ones already running off it, and Enable puts it back into service. Maintenance mode is those three actions rather than one flag.

Example 3: Run the ListMethods operation by name

PS> Invoke-XenHost -XenAction ListMethods -Name "Demo Host" -PassThru
Invokes the ListMethods operation on a Host. -Name matches on name\_label, which is not unique, so every match is operated on. -PassThru writes the result to the pipeline.
  • Class: Host
  • Using the XenServer PowerShell module