Invoke-XenSR

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

Syntax

Invoke-XenSR [-SR] <SR>
    -XenAction {Introduce | Make | Forget | Update | Scan | Probe | ProbeExt | CreateNewBlob | AssertCanHostHaStatefile | AssertSupportsDatabaseReplication | EnableDatabaseReplication | DisableDatabaseReplication | RecordDataSource | QueryDataSource | ForgetDataSourceArchives}
    [-PassThru] [-BestEffort] [-SessionOpaqueRef <string>] [-WhatIf] [-Confirm] [-Async]
    [<CommonParameters>]
Invoke-XenSR [-Ref] <XenRef[SR]>
    -XenAction {Introduce | Make | Forget | Update | Scan | Probe | ProbeExt | CreateNewBlob | AssertCanHostHaStatefile | AssertSupportsDatabaseReplication | EnableDatabaseReplication | DisableDatabaseReplication | RecordDataSource | QueryDataSource | ForgetDataSourceArchives}
    [-PassThru] [-BestEffort] [-SessionOpaqueRef <string>] [-WhatIf] [-Confirm] [-Async]
    [<CommonParameters>]
Invoke-XenSR [-Uuid] <guid>
    -XenAction {Introduce | Make | Forget | Update | Scan | Probe | ProbeExt | CreateNewBlob | AssertCanHostHaStatefile | AssertSupportsDatabaseReplication | EnableDatabaseReplication | DisableDatabaseReplication | RecordDataSource | QueryDataSource | ForgetDataSourceArchives}
    [-PassThru] [-BestEffort] [-SessionOpaqueRef <string>] [-WhatIf] [-Confirm] [-Async]
    [<CommonParameters>]
Invoke-XenSR [-Name] <string>
    -XenAction {Introduce | Make | Forget | Update | Scan | Probe | ProbeExt | CreateNewBlob | AssertCanHostHaStatefile | AssertSupportsDatabaseReplication | EnableDatabaseReplication | DisableDatabaseReplication | RecordDataSource | QueryDataSource | ForgetDataSourceArchives}
    [-PassThru] [-BestEffort] [-SessionOpaqueRef <string>] [-WhatIf] [-Confirm] [-Async]
    [<CommonParameters>]

Description

Invokes an operation on an SR object. Use the -XenAction parameter to select which operation to perform.
Introduce: Introduce a new Storage Repository into the managed system.
Make: Create a new Storage Repository on disk. This call is deprecated: use SR.create instead. (Deprecated.)
Forget: Removing specified SR-record from database, without attempting to remove SR from disk.
Update: Refresh the fields on the SR object.
Scan: Refreshes the list of VDIs associated with an SR.
Probe: Perform a backend-specific scan, using the given device\_config. If the device\_config is complete, then this will return a list of the SRs present of this type on the device, if any. If the device\_config is partial, then a backend-specific scan will be performed, returning results that will guide the user in improving the device\_config.
ProbeExt: Perform a backend-specific scan, using the given device\_config. If the device\_config is complete, then this will return a list of the SRs present of this type on the device, if any. If the device\_config is partial, then a backend-specific scan will be performed, returning results that will guide the user in improving the device\_config.
CreateNewBlob: Create a placeholder for a named binary blob of data that is associated with this SR.
AssertCanHostHaStatefile: Returns successfully if the given SR can host an HA statefile. Otherwise returns an error to explain why not.
AssertSupportsDatabaseReplication: Returns successfully if the given SR supports database replication. Otherwise returns an error to explain why not.
EnableDatabaseReplication
DisableDatabaseReplication
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.

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

-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

-Confirm

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

-ContentType

The type of the new SRs content, if required (for example, ISOs). Accepted when -XenAction is Introduce, Make.
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

-DeviceConfig

The device config string that will be passed to backend SR driver. Accepted when -XenAction is Make, Probe, ProbeExt.
Attribute Value
Type hashtable
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 SR to operate on.
Attribute Value
Type string
Required True
Position 0
Accepts pipeline input True (ByPropertyName)
Aliases name_label

-NameDescription

The description of the new storage repository. Accepted when -XenAction is Introduce, Make.
Attribute Value
Type string
Required False
Position Named
Accepts pipeline input False

-NameLabel

The name of the new storage repository. Accepted when -XenAction is Introduce, Make.
Attribute Value
Type string
Required False
Position Named
Accepts pipeline input False

-NameParam

The name associated with the blob. Accepted when -XenAction is CreateNewBlob.
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

-PhysicalSize

The physical size of the new storage repository. Accepted when -XenAction is Make.
Attribute Value
Type long
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 SR object to operate on, specified by its opaque reference.
Attribute Value
Type XenRef[SR]
Required True
Position 0
Accepts pipeline input True (ByPropertyName)
Aliases opaque_ref

-SR

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

-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

-Shared

True if the SR (is capable of) being shared by multiple hosts. Accepted when -XenAction is Introduce.
Attribute Value
Type bool
Required False
Position Named
Accepts pipeline input False

-SmConfig

Storage backend specific configuration options. Accepted when -XenAction is Introduce, Make, Probe, ProbeExt.
Attribute Value
Type hashtable
Required False
Position Named
Accepts pipeline input False

-Type

The type of the SR; used to specify the SR backend driver to use. Accepted when -XenAction is Introduce, Make, Probe, ProbeExt.
Attribute Value
Type string
Required False
Position Named
Accepts pipeline input False

-Uuid

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

-UuidParam

The uuid assigned to the introduced SR. Accepted when -XenAction is Introduce.
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

-XenAction

Selects which action to use.
Attribute Value
Type XenSRAction
Required True
Position Named
Accepts pipeline input False
Accepted values Introduce, Make, Forget, Update, Scan, Probe, ProbeExt, CreateNewBlob, AssertCanHostHaStatefile, AssertSupportsDatabaseReplication, EnableDatabaseReplication, DisableDatabaseReplication, RecordDataSource, QueryDataSource, ForgetDataSourceArchives

-XenHost

The host to create/make the SR on. Accepted when -XenAction is Make, Probe, ProbeExt.
Attribute Value
Type XenRef[Host]
Required False
Position Named
Accepts pipeline input False

Inputs

  • SR
  • XenRef[SR]
  • guid
  • string

Outputs

  • System.Object

Examples

Example 1: Run the Introduce operation

PS> Get-XenSR -Name "Demo SR" | Invoke-XenSR -XenAction Introduce -PassThru
Invokes the Introduce operation on an SR. -PassThru writes the result to the pipeline.

Example 2: Run the Introduce operation by name

PS> Invoke-XenSR -XenAction Introduce -Name "Demo SR" -PassThru
Invokes the Introduce operation on an SR. -Name matches on name\_label, which is not unique, so every match is operated on. -PassThru writes the result to the pipeline.

Example 3: Run Introduce asynchronously

PS> Invoke-XenSR -Name "Demo SR" -XenAction Introduce -Async -PassThru | Wait-XenTask -ShowProgress
Runs the same operation asynchronously and follows the task it returns.
  • Class: SR
  • Using the XenServer PowerShell module