Skip to content
This repository was archived by the owner on Feb 19, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 40 additions & 40 deletions powershell/about_XenServer.help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
XenServer PowerShell Module v@SDK_VERSION@
----------------------------------

This document provides a high level walk­through of the XenServer PowerShell Module
This document provides a high level walk-through of the XenServer PowerShell Module
and the structure of its cmdlets.


XenServer sessions
------------------

The first cmdlet you will need is ConnectXenServer to open a session to a server:
The first cmdlet you will need is Connect-XenServer to open a session to a server:

PS> Connect-XenServer -Url https://<servername> -UserName user -Password pwd

Expand All @@ -34,7 +34,7 @@ default session has been specified.
Once you have finished interacting with a server, it is good practice to log out
using the cmdlet Disconnect-XenServer:

PS> GetXenSession | DisconnectXenServer
PS> Get-XenSession | Disconnect-XenServer


Managing XenAPI objects
Expand All @@ -45,112 +45,112 @@ The cmdlets fall into the following categories:
1. Class Getters

These retrieve a XenAPI object and have names such as Get-XenT, where T is an
exposed XenAPI class. The object to get can be specified by Ref or, for those
that have a uuid or name, Name or Uuid. If no parameters are specified, all
exposed XenAPI class. The object to get can be specified by -Ref or, for those
that have a uuid or name, -Name or -Uuid. If no parameters are specified, all
objects of this type are returned. Example:

PS> GetXenHost Name "Demo Host"
PS> Get-XenHost -Name "Demo Host"

2. Constructors

These create a new XenAPI object and have names such as New-XenT, where T is
an exposed XenAPI class. Example:

PS> $vm = GetXenVM Name "Demo VM"
PS> NewXenVBD VM $vm VDI $null Userdevice 3 Bootable $false Mode RO
Type CD Unpluggable $true Empty $true OtherConfig @{}
QosAlgorithmType "" QosAlgorithmParams @{}
PS> $vm = Get-XenVM -Name "Demo VM"
PS> New-XenVBD -VM $vm -VDI $null -Userdevice 3 -Bootable $false -Mode RO `
-Type CD -Unpluggable $true -Empty $true -OtherConfig @{} `
-QosAlgorithmType "" -QosAlgorithmParams @{}

3. Class Removers

These destroy a XenAPI object and have names such as Remove-XenT, where T is
an exposed XenAPI class. To specify the object to remove use the parameter
T, where T is the exposed XenAPI class, or Ref or, for those objects that
have a uuid or name, UUID or Name. Example:
-T, where T is the exposed XenAPI class, or -Ref or, for those objects that
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I notice some changes around hyphens. Several symbols exist in UTF8 but not in Ascii, where we just have the minus, which is used for everything. Code that is pasted into the shell use the minus as otherwise it would not be recognised despite looking correct.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, the old "hyphens" were in reality this character in UTF-16: \u00e2\u0080\u0090. I've turned them to minus.

have a uuid or name, -UUID or -Name. Example:

PS> GetXenSR Name "Demo SR" | RemoveXenSR
PS> Get-XenSR -Name "Demo SR" | Remove-XenSR

4. Property Setters

These set a field of a XenAPI object and have names such as Set-XenT, where
T is an exposed XenAPI class. To specify the object use the parameter T, where
T is the exposed XenAPI class, or Ref or, for those objects that have a uuid
or name, UUID or Name. The field to set can be specified as an accordingly
T is an exposed XenAPI class. To specify the object use the parameter -T, where
T is the exposed XenAPI class, or -Ref or, for those objects that have a uuid
or name, -UUID or -Name. The field to set can be specified as an accordingly
named parameter. Note that more than one fields at a time can be set in a
synchronous call. Example:

PS> GetXenVM Name "Demo VM" | Set‐XenVM ‐NameLabel "New name"
-NameDescription "New description"
PS> Get-XenVM -Name "Demo VM" |`
Set-XenVM -NameLabel "New name" -NameDescription "New description"

5. Property Adders

These add an element to a field of a XenAPI object and have names such as
Add-XenT, where T is an exposed XenAPI class. To specify the object use the
parameter T, where T is the exposed XenAPI class, or Ref or, for those objects
that have a uuid or name, UUID or Name. The field to which the element
parameter -T, where T is the exposed XenAPI class, or -Ref or, for those objects
that have a uuid or name, -UUID or -Name. The field to which the element
will be added can be specified as an accordingly named parameter. Note that
elements can be added to more than one fields at a time in a synchronous call.
Example:

PS> AddXenHost Name "Demo Host" Tags "Tag1"
PS> Add-XenHost -Name "Demo Host" -Tags "Tag1"

6. Property Removers

These remove an element from a field of a XenAPI object and have names such
as Remove-XenTProperty, where T is an exposed XenAPI class. To specify the
object use the parameter T, where T is the exposed XenAPI class, or Ref or,
for those objects that have a uuid or name, UUID or Name. The field from
object use the parameter -T, where T is the exposed XenAPI class, or -Ref or,
for those objects that have a uuid or name, -UUID or -Name. The field from
which the element will be removed can be specified as an accordingly named
parameter. Note that elements can be removed from more than one fields at a
time in a synchronous call. Example:

PS> RemoveXenHostProperty Name "myHost" Tags "tag1" OtherConfig "myKey"
PS> Remove-XenHostProperty -Name "myHost" -Tags "tag1" -OtherConfig "myKey"

7. Property Getters

These retrieve the value of a field of a XenAPI object and have names such as
Get-XenTProperty, where T is an exposed XenAPI class. To specify the object
use the parameters T, where T is the exposed XenAPI class, or Ref. To specify
the field use the enum parameter XenProperty. Example:
use the parameters -T, where T is the exposed XenAPI class, or -Ref. To specify
the field use the enum parameter -XenProperty. Example:

PS> GetXenPIFProperty Ref OpaqueRef:f433bf7b2b0c5f5370187d195addb3ca
XenProperty Network
PS> Get-XenPIFProperty -Ref OpaqueRef:f433bf7b-2b0c-5f53-7018-7d195addb3ca `
-XenProperty Network

8. Invokers

These invoke operations on XenAPI objects and have names such as Invoke-XenT,
where T is an exposed XenAPI class. To specify the object use the parameter
T, where T is the exposed XenAPI class, or Ref or, for those objects that
have a uuid or name, UUID or Name. To specify the call to invoke, use the
enum parameter XenAction. Example:
-T, where T is the exposed XenAPI class, or -Ref or, for those objects that
have a uuid or name, -UUID or -Name. To specify the call to invoke, use the
enum parameter -XenAction. Example:

PS> GetXenPBD Uuid 1871ac51ce6befc37fd028bc65aa39ff | Invoke‐XenPBD
XenAction Unplug
PS> Get-XenPBD -Uuid 1871ac51-ce6b-efc3-7fd0-28bc65aa39ff |`
Invoke-XenPBD -XenAction Unplug


Most of the XenAPI calls can be run synchronously or asynchronously. To run a
cmdlet asynchronously use the parameter Async where available.
cmdlet asynchronously use the parameter -Async where available.

Note that, in the case of the setters, only one field can be set asynchronously
at a time, and in the case of the adders and removers, elements can be added or
removed asynchronously to only one field at a time.

Also, note that the cmdlets that are not explicit "getters" but return objects,
do so only when the standard parameter PassThru is specified. These cmdlets are
ConnectXenServer, the constructors, adders, setters, certain invokers,
do so only when the standard parameter -PassThru is specified. These cmdlets are
Connect-XenServer, the constructors, adders, setters, certain invokers,
the property removers, as well as all the asynchronous calls from any category.
In the latter case, the cmdlet returns a Task object, the progress of which can
be tracked by piping it into the cmdlet Wait-XenTask:

PS> Invoke-XenVM -Name $vm_name -XenAction Start -Async -PassThru
| Wait-XenTask -ShowProgress
PS> Invoke-XenVM -Name $vm_name -XenAction Start -Async -PassThru |`
Wait-XenTask -ShowProgress

Wait-XenTask, too, can be used with the -PassThru parameter and, where applicable,
it returns the opaque reference of the object that would be returned if the call
were run synchronously.

Finally, as many of the cmdlets handle objects of type XenRef<T>, where T is an
exposed API class, the cmldet ConvertToXenRef can be used to aid conversion
exposed API class, the cmldet ConvertTo-XenRef can be used to aid conversion
between the two. Example:

PS> GetXenVM Name "Demo VM" | ConvertToXenRef
PS> Get-XenVM -Name "Demo VM" | ConvertTo-XenRef
Loading