New-XenUser

Last published : Nov 12, 2026
\[Deprecated\] Creates a new User object.

Syntax

New-XenUser -HashTable <hashtable> [-PassThru] [-BestEffort] [-SessionOpaqueRef <string>]
    [-WhatIf] [-Confirm] [-Async] [<CommonParameters>]
New-XenUser -Record <User> [-PassThru] [-BestEffort] [-SessionOpaqueRef <string>]
    [-WhatIf] [-Confirm] [-Async] [<CommonParameters>]
New-XenUser [-PassThru] [-ShortName <string>] [-Fullname <string>]
    [-OtherConfig <hashtable>] [-BestEffort] [-SessionOpaqueRef <string>] [-WhatIf]
    [-Confirm] [-Async] [<CommonParameters>]

Description

DEPRECATED. This class has been deprecated.
Creates a new User object.
User: A user of the system.

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

-Fullname

full name
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 User.
Attribute Value
Type hashtable
Required True
Position Named
Accepts pipeline input False

-OtherConfig

additional configuration
Attribute Value
Type hashtable
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 User record whose fields are used to create the new object.
Attribute Value
Type User
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

-ShortName

short name (for example, userid)
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

  • User
  • Task
  • void

Examples

Example 1: Create a User from a table of fields

PS> New-XenUser -HashTable @{ name_label = "Demo User" } -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 User.

Example 2: Create a User from parameters

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

Example 3: Run against a particular session

PS> New-XenUser -HashTable @{ name_label = "Demo User" } -PassThru -SessionOpaqueRef $session.opaque_ref
Every cmdlet takes -SessionOpaqueRef, which runs it against a session opened with Connect-XenServer rather than the default one. It is how a script drives more than one server at a time.
  • Class: User
  • Using the XenServer PowerShell module