Get-XenSR

Last published : Nov 12, 2026
Gets the SR objects in the pool.

Syntax

Get-XenSR [[-Ref] <XenRef[SR]>] [-BestEffort] [-SessionOpaqueRef <string>]
    [<CommonParameters>]
Get-XenSR [-Uuid] <guid> [-BestEffort] [-SessionOpaqueRef <string>] [<CommonParameters>]
Get-XenSR [-Name] <string> [-BestEffort] [-SessionOpaqueRef <string>] [<CommonParameters>]

Description

Retrieves the SR objects in the pool. With no parameters the cmdlet returns the whole collection; use -Name, -Uuid or -Ref to select one.
SR: A storage repository.

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

-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

-Ref

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

-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

-Uuid

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

Inputs

  • XenRef[SR]
  • guid
  • string

Outputs

  • SR[]

Examples

Example 1: List every SR

PS> Get-XenSR
Retrieves every SR object in the pool. With no parameters the cmdlet fetches the whole collection.

Example 2: Rank storage repositories by free space

PS> Get-XenSR |
    Sort-Object { $_.physical_size - $_.physical_utilisation } -Descending |
    Select-Object name_label, physical_size, physical_utilisation
Free space is not a field: it is the physical size less what is already used. Both are in bytes.

Example 3: Retrieve one SR by name

PS> Get-XenSR -Name "Demo SR"
Retrieves a single SR. -Name matches on name\_label, which is not unique, so every match is operated on.
  • Class: SR
  • Using the XenServer PowerShell module