Remove-XenSubjectProperty

Last published : Nov 12, 2026
Removes values from fields of a Subject object.

Syntax

Remove-XenSubjectProperty [-Subject] <Subject> [-PassThru] [-Roles <XenRef[Role]>]
    [-BestEffort] [-SessionOpaqueRef <string>] [-WhatIf] [-Confirm] [<CommonParameters>]
Remove-XenSubjectProperty [-Ref] <XenRef[Subject]> [-PassThru] [-Roles <XenRef[Role]>]
    [-BestEffort] [-SessionOpaqueRef <string>] [-WhatIf] [-Confirm] [<CommonParameters>]
Remove-XenSubjectProperty [-Uuid] <guid> [-PassThru] [-Roles <XenRef[Role]>] [-BestEffort]
    [-SessionOpaqueRef <string>] [-WhatIf] [-Confirm] [<CommonParameters>]

Description

Removes values from the collection-valued fields of a Subject. Each optional parameter listed below corresponds to a field that can be removed from.

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

-Confirm

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

-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

-Ref

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

-Roles

This call removes a role from a subject
Attribute Value
Type XenRef[Role]
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

-Subject

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

-Uuid

The UUID of the Subject 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

Inputs

  • Subject
  • XenRef[Subject]
  • guid

Outputs

  • Subject

Examples

Example 1: Remove a roles

PS> $role = Get-XenRole | Select-Object -First 1
PS> Remove-XenSubjectProperty -Roles $role -Uuid 1871ac51-ce6b-efc3-7fd0-28bc65aa39ff
This call removes a role from a subject

Example 2: Remove a roles piped from the getter

PS> $role = Get-XenRole | Select-Object -First 1
PS> Get-XenSubject -Uuid 1871ac51-ce6b-efc3-7fd0-28bc65aa39ff | Remove-XenSubjectProperty -Roles $role
This call removes a role from a subject The object is piped in, which is the usual way once you already have it.

Example 3: Remove a roles by reference

PS> $role = Get-XenRole | Select-Object -First 1
PS> Remove-XenSubjectProperty -Roles $role -Ref OpaqueRef:f433bf7b-2b0c-5f53-7018-7d195addb3ca
This call removes a role from a subject -Ref takes the opaque reference, which is what the API itself uses and what the records hold.