Citrix Virtual Apps and Desktops 2411 SDK

New-ProvVM

Creates new virtual machines.

Syntax

New-ProvVM
   -ProvisioningSchemeName <String>
   -ADAccountName <String[]>
   [-FastBuild]
   [-NetworkMapping <Hashtable>]
   [-AutoAssignVLAN]
   [-SecurityGroup <String[]>]
   [-MachinesPerAssistant <Int32>]
   [-MaxAssistants <Int32>]
   [-RunAsynchronously]
   [-PurgeJobOnSuccess]
   [-LoggingId <Guid>]
   [<CitrixCommonParameters>]
   [<CommonParameters>]
<!--NeedCopy-->
New-ProvVM
   -ProvisioningSchemeUid <Guid>
   -ADAccountSid <String[]>
   [-FastBuild]
   [-NetworkMapping <Hashtable>]
   [-AutoAssignVLAN]
   [-SecurityGroup <String[]>]
   [-MachinesPerAssistant <Int32>]
   [-MaxAssistants <Int32>]
   [-RunAsynchronously]
   [-PurgeJobOnSuccess]
   [-LoggingId <Guid>]
   [<CitrixCommonParameters>]
   [<CommonParameters>]
<!--NeedCopy-->
New-ProvVM
   -ProvisioningSchemeName <String>
   -ADAccountSid <String[]>
   [-FastBuild]
   [-NetworkMapping <Hashtable>]
   [-AutoAssignVLAN]
   [-SecurityGroup <String[]>]
   [-MachinesPerAssistant <Int32>]
   [-MaxAssistants <Int32>]
   [-RunAsynchronously]
   [-PurgeJobOnSuccess]
   [-LoggingId <Guid>]
   [<CitrixCommonParameters>]
   [<CommonParameters>]
<!--NeedCopy-->
New-ProvVM
   -ProvisioningSchemeUid <Guid>
   -ADAccountName <String[]>
   [-FastBuild]
   [-NetworkMapping <Hashtable>]
   [-AutoAssignVLAN]
   [-SecurityGroup <String[]>]
   [-MachinesPerAssistant <Int32>]
   [-MaxAssistants <Int32>]
   [-RunAsynchronously]
   [-PurgeJobOnSuccess]
   [-LoggingId <Guid>]
   [<CitrixCommonParameters>]
   [<CommonParameters>]
<!--NeedCopy-->

Description

Lets you create new virtual machines with the configuration specified by a provisioning scheme.

The virtual machines are created using all of the storage specified in the provisioning scheme. The storage are used in a Round Robin mechanism.

For the duration of this task, the AD accounts are locked by the AD Identity Service, which prevents the same accounts from being used by other machine creation tasks.

Examples

EXAMPLE 1

Creates a new virtual machine using the AD account “domain\account” in the provisioning scheme “MyScheme”.

New-ProvVM -ProvisioningSchemeName MyScheme -ADAccountName "domain\Account"

TaskId                             : 90e93b9d-a225-4701-ad50-fa1546af35ac
Type                               : NewVirtualMachine
Status                             : Finished
CurrentOperation                   :
TaskProgress                       : 100
TaskExpectedCompletion             :
LastUpdateTime                     : 17/05/2020 08:24:08
ActiveElapsedTime                  : 11
DateStarted                        : 17/05/2020 08:22:22
DateFinished                       : 17/05/2020 08:24:08
TerminatingError                   :
WorkflowStatus                     : Completed
MasterImage                        : /Base.vm/Base.snapshot
MasterImageId                      : base-vm\base
ProvisioningSchemeName             : MyScheme
StatusMessageSubstitutions         : {}
ProvisioningSchemeUid              : 7585f0de-192e-4847-a6d8-22713c3a2f42
TaskState                          : Finished
TaskStateInformation               :
HostingUnitUid                     : 01a4a008-8ce8-4165-ba9c-cdf15a6b0501
HostingUnitName                    : XenHU
IdentityPoolUid                    : 03743136-e43b-4a87-af74-ab71686b3c16
IdentityPoolName                   : idPool1
VirtualMachinesToCreateCount       : 1
VirtualMachinesCreatedCount        : 1
VirtualMachinesCreationFailedCount : 0
CreatedVirtualMachines             : {DOMAIN\Account$}
FailedVirtualMachines              : {}
<!--NeedCopy-->

EXAMPLE 2

Creates a new virtual machine using the AD Account Sid “S-1-254-569073838-1281390506-2920376713-1253648347-1001” in the provisioning scheme “MyScheme”.

New-ProvVM -ProvisioningSchemeName MyScheme -ADAccountSid "S-1-254-569073838-1281390506-2920376713-1253648347-1001"

TaskId                             : 587717c5-4763-41e1-80c6-1d1fb32fa1fd
Type                               : NewVirtualMachine
Status                             : Finished
CurrentOperation                   :
TaskProgress                       : 100
TaskExpectedCompletion             :
LastUpdateTime                     : 17/10/2022 08:24:08
ActiveElapsedTime                  : 11
DateStarted                        : 17/10/2022 08:22:22
DateFinished                       : 17/10/2022 08:24:08
TerminatingError                   :
WorkflowStatus                     : Completed
MasterImage                        : /Base.vm/Base.snapshot
MasterImageId                      : base-vm\base
ProvisioningSchemeName             : MyScheme
StatusMessageSubstitutions         : {}
ProvisioningSchemeUid              : 7585f0de-192e-4847-a6d8-22713c3a2f42
TaskState                          : Finished
TaskStateInformation               :
HostingUnitUid                     : 01a4a008-8ce8-4165-ba9c-cdf15a6b0501
HostingUnitName                    : XenHU
IdentityPoolUid                    : 03743136-e43b-4a87-af74-ab71686b3c16
IdentityPoolName                   : idPool1
VirtualMachinesToCreateCount       : 1
VirtualMachinesCreatedCount        : 1
VirtualMachinesCreationFailedCount : 0
CreatedVirtualMachines             : {Account$}
FailedVirtualMachines              : {}
<!--NeedCopy-->

EXAMPLE 3

Creates a new virtual machine using the AD account “domain\account” in the provisioning scheme “MyScheme” asynchronously. To get the task details, use Get-ProvTask -TaskID <task id> .

New-ProvVM -ProvisioningSchemeName MyScheme -ADAccountName "domain\Account" -RunAsynchronously

Guid
----
6dd85fec-96cf-46b1-9cd4-d8ba7d06e85b

Get-ProvTask -TaskID 6dd85fec-96cf-46b1-9cd4-d8ba7d06e85b

TaskId                             : 4b49f13a-277c-4cb0-bc40-f088430cfe8a
Type                               : NewVirtualMachine
Status                             : Finished
CurrentOperation                   :
TaskProgress                       : 100
TaskExpectedCompletion             :
LastUpdateTime                     : 17/05/2020 08:24:08
ActiveElapsedTime                  : 11
DateStarted                        : 17/05/2020 08:22:22
DateFinished                       : 17/05/2020 08:24:08
TerminatingError                   :
WorkflowStatus                     : Completed
MasterImage                        : /Base.vm/Base.snapshot
MasterImageId                      : base-vm\base
ProvisioningSchemeName             : MyScheme
StatusMessageSubstitutions         : {}
ProvisioningSchemeUid              : 7585f0de-192e-4847-a6d8-22713c3a2f42
TaskState                          : Finished
TaskStateInformation               :
HostingUnitUid                     : 01a4a008-8ce8-4165-ba9c-cdf15a6b0501
HostingUnitName                    : XenHU
IdentityPoolUid                    : 03743136-e43b-4a87-af74-ab71686b3c16
IdentityPoolName                   : idPool1
VirtualMachinesToCreateCount       : 1
VirtualMachinesCreatedCount        : 1
VirtualMachinesCreationFailedCount : 0
CreatedVirtualMachines             : {DOMAIN\Account$}
FailedVirtualMachines              : {}
<!--NeedCopy-->

EXAMPLE 4

Creates new virtual machines using all of the available AD accounts from the identity pool “MyPool” in the provisioning scheme “MyScheme” asynchronously. To get the task details, use Get-ProvTask -TaskID <task id>.

$accounts = Get-AcctAdAccount -IdentityPool MyPool -State Available
New-ProvVM -ProvisioningSchemeName MyScheme -ADAccountName $t -RunAsyncronously
Get-ProvTask -TaskID 6dd85fec-96cf-46b1-9cd4-d8ba7d06e85b

TaskId                             : 4b49f13a-277c-4cb0-bc40-f088430cfe8a
Type                               : NewVirtualMachine
Status                             : Finished
CurrentOperation                   :
TaskProgress                       : 100
TaskExpectedCompletion             :
LastUpdateTime                     : 17/05/2020 08:24:08
ActiveElapsedTime                  : 108
DateStarted                        : 17/05/2020 08:22:22
DateFinished                       : 17/05/2020 08:34:08
TerminatingError                   :
WorkflowStatus                     : Completed
MasterImage                        : /Base.vm/Base.snapshot
MasterImageId                      : base-vm\base
ProvisioningSchemeName             : MyScheme
StatusMessageSubstitutions         : {}
ProvisioningSchemeUid              : 7585f0de-192e-4847-a6d8-22713c3a2f42
TaskState                          : Finished
TaskStateInformation               :
HostingUnitUid                     : 01a4a008-8ce8-4165-ba9c-cdf15a6b0501
HostingUnitName                    : XenHU
IdentityPoolUid                    : 03743136-e43b-4a87-af74-ab71686b3c16
IdentityPoolName                   : idPool1
VirtualMachinesToCreateCount       : 10
VirtualMachinesCreatedCount        : 10
VirtualMachinesCreationFailedCount : 0
CreatedVirtualMachines             : {DOMAIN\Account1$,...}
FailedVirtualMachines              : {}
<!--NeedCopy-->

Parameters

-ProvisioningSchemeName

The name of the provisioning scheme in which the VMs are created.

Type: String
Position: Named
Default value: None
Required: True
Accept pipeline input: False
Accept wildcard characters: False

-ADAccountName

A list of the Active Directory account names that are used for the VMs. The accounts must be provided in a domain-qualified format. This parameter accepts Identity objects as returned by the New-AcctADAccount cmdlet,

or any PSObject with string properties “Domain” and “ADAccountName”.

Type: String[]
Position: Named
Default value: None
Required: True
Accept pipeline input: False
Accept wildcard characters: False

-ADAccountSid

A list of the Active Directory account sids that are used for the VMs.

Type: String[]
Position: Named
Default value: None
Required: True
Accept pipeline input: False
Accept wildcard characters: False
Introduced in: Citrix Virtual Apps and Desktop 7 2303

-ProvisioningSchemeUid

The unique identifier of the provisioning scheme in which the VMs are created.

Type: Guid
Position: Named
Default value: None
Required: True
Accept pipeline input: False
Accept wildcard characters: False

-FastBuild

Indicates whether the command can run faster by using optimizations in the creation process. This may mean that VMs created cannot be started until ResetVM operations have been performed by the Broker and Machine Identity Services.

Type: SwitchParameter
Position: Named
Default value: None
Required: False
Accept pipeline input: False
Accept wildcard characters: False

-NetworkMapping

Specifies how the attached NICs are mapped to networks. If this parameter is omitted, provisioned VMs are created with network settings as inherited from the provisioning scheme. If this parameter is supplied, machines are created with the number of NICs specified in the map, and each NIC is attached to the specified network.

Type: Hashtable
Position: Named
Default value: None
Required: False
Accept pipeline input: False
Accept wildcard characters: False

-AutoAssignVLAN

Indicates whether the VLAN of the network should be automatically assigned to the new VM or if the VLAN from the master image should be used

Type: SwitchParameter
Position: Named
Default value: False
Required: False
Accept pipeline input: False
Accept wildcard characters: False

-SecurityGroup

The security groups to apply to machines created in Cloud Hypervisors.

Type: String[]
Position: Named
Default value: None
Required: False
Accept pipeline input: False
Accept wildcard characters: False

-MachinesPerAssistant

The number of concurrent volume operations that may be performed by each volume worker helper machine.

Type: Int32
Position: Named
Default value: None
Required: False
Accept pipeline input: False
Accept wildcard characters: False

-MaxAssistants

The maximum number of volume worker help machines that may be created for this operation.

Type: Int32
Position: Named
Default value: None
Required: False
Accept pipeline input: False
Accept wildcard characters: False

-RunAsynchronously

Indicates whether the command returns before it completes. If specified, the command returns an identifier for the task that was created. This task can be monitored using the Get-ProvTask command.

Type: SwitchParameter
Position: Named
Default value: False
Required: False
Accept pipeline input: False
Accept wildcard characters: False

-PurgeJobOnSuccess

Indicates that the task history is removed from the database when the task completes. This cannot be specified for tasks that run asynchronously.

Type: SwitchParameter
Position: Named
Default value: None
Required: False
Accept pipeline input: False
Accept wildcard characters: False

-LoggingId

Specifies the identifier of the high-level operation this cmdlet call forms a part of. Citrix Studio and Director typically create high-level operations. PowerShell scripts can also wrap a series of cmdlet calls in a high-level operation by way of the Start-LogHighLevelOperation and Stop-LogHighLevelOperation cmdlets.

Type: Guid
Position: Named
Default value: None
Required: False
Accept pipeline input: False
Accept wildcard characters: False

CitrixCommonParameters

This cmdlet supports the common Citrix parameters: -AdminAddress, -AdminClientIP, -BearerToken, -TraceParent, -TraceState and -VirtualSiteId. For more information, see about_CitrixCommonParameters.

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

None

You can’t pipe objects to this cmdlet.

Outputs

Guid

When the RunAsynchronously identifier is specified, this GUID is returned and provides the task identifier.

System.Management.Automation.PSCustomObject

This object provides details of the task that was run and contains the following information:

TaskId <Guid>

The identifier for the task that was performed.

Type <Citrix.XDInterServiceTypes.JobType>

The type of task. For provisioning new VM tasks, this is always “NewVirtualMachine”.

Status <string>

Where in its lifecycle the task is.

CurrentOperation <string>

Operation specific phase of the overall “Running” task state.

TaskProgress <double>

The progress of the task 0-100%.

TaskExpectedCompletion <DateTime>

The date and time at which the task is expected to complete.

LastUpdateTime <DateTime>

The date and time of the last task status update.

ActiveElapsedTime <int>

Number of seconds the task has taken for active execution.

DateStarted <DateTime>

The date and time when the task was started.

DateFinished <DateTime>

The date and time when the task was completed.

TerminatingError < Citrix.Fma.Sdk.ServiceCore.CommonCmdlets.TaskterminatingError>

Diagnostic information if the task completely fails.

WorkflowStatus <System.Workflow.Runtime.WorkflowStatus>

Indicates the status of the workflow that is used to process the task.

MasterImage <string>

The inventory path of the VM snapshot that was used as the master image for the task.

MasterImageId <string>

The unique identifier of the VM snapshot as assigned by the hosting unit.

ProvisioningSchemeName <string>

The name of the provisioning scheme associated with the task.

StatusMessageSubstitutions <string[]>

List of strings to be substituted into custom error or status messages from provisioning plug-ins.

ProvisioningSchemeUid <Guid>

The unique identifier of the provisioning scheme associated with the task.

TaskState <Citrix.DesktopUpdateManager.SDK.ProvisionVMState>

The state of the task. This can be any of the following:

Processing

Indicates that the task is in its initial state.

LocatingResources,

Indicates that the task is locating information from other services.

HostingUnitNotFound

Indicates that the required hosting unit could not be located.

ProvisioningSchemeNotFound

Indicates that the required provisioning scheme could not be located.

Provisioning

Indicates that the task is at the provisioning stage.

IdentityPoolNotFound

Indicates that the required identity pool could not be located.

TaskAlreadyRunningForProvisioningScheme

Indicates that the provisioning scheme already has another task running.

HypervisorInMaintenanceMode

Indicates that the hypervisor is not available for normal use.

NoAvailableStorage

Indicates that no storage is available for the hypervisor.

NoAvailableNetwork

Indicates that no network is available for the hypervisor.

Finalizing

Indicates that the task is finalizing.

Finished

Indicates that the task is complete.

FinishedWithErrors

Indicates that the task is complete but there were errors. Specific details of errors are included with each failed virtual machine.

Removing

Indicates that the task is removing virtual machines from the hypervisor.

Failed

The job failed for reasons specified in TaskStateInformation.

Canceled

Indicates that the task was stopped by user intervention (using Stop-ProvTask).

TaskStateInformation

Provides more detailed information about the current task state.

HostingUnitUid

The unique identifier of the hosting unit that is used by the provisioning task.

HostingUnitName <string>

The name of the hosting unit that is used by the provisioning task.

IdentityPoolUid <guid>

The unique identifier of the identity pool that is used by the provisioning task.

IdentityPoolName <string>

The name of the identity pool that is used by the provisioning task.

VirtualMachinesToCreateCount <int>

The total number of virtual machines that the task is trying to create.

VirtualMachinesCreatedCount <int>

The number of virtual machines that the task has created so far. Details of the machines that were created are in the CreatedVirtualMachines parameter.

VirtualMachinesCreationFailedCount <int>

The number of virtual machines that the task has failed to create. Details of the machines that were not created are in the FailedVirtualMachines parameter.

CreatedVirtualMachines <Citrix.DesktopUpdateManager.SDK.VirtualMachineCreation[]>

Object array of created virtual machines summary information. The object properties are:

ADAccountName <string>

The domain qualified AD Account name of the machine.

ADAccountSid <string>

The AD account SID of the machine account.

DiagnosticInformation <Citrix.MachineCreation.Sdk.ExceptionSurrogate[]>

A collection of handled error states which caused the provisioning to fail.

ExceptionType <string>

The type of exception this object represents.

Message <string>

The exception message.

Details <string>

The full exception content including stack trace.

InnerException <Citrix.MachineCreation.Sdk.ExceptionSurrogate>

Information relating to any contributing error state.

Status <string>

The status of the virtual machine.

StatusAdditionalInformation <string>

Extra information about the Status.

VMId <string>

The virtual machine identifier within the hypervisor in which the VM resides.

VMName <string>

The display name of the virtual machine within the hypervisor in which the VM resides.

FailedVirtualMachines <Citrix.DesktopUpdateManager.SDK.VirtualMachineCreation[]>

See CreatedVirtualMachines for details of the object parameters.

Notes

The cmdlet is associated with a task of type NewVirtualMachine, and while active will move through the following operations (CurrentOperation field)

ValidatingInputs

CreatingVirtualMachines

ReleasingAccountLocks

Only one long-running task in each provisioning scheme can be processed at a time.

In the case of failure, the following errors can result.

Error Codes


JobCreationFailed

The requested task could not be started.

DatabaseError

An error occurred in the service while attempting a database operation.

DatabaseNotConfigured

The operation could not be completed because the database for the service is not configured.

ServiceStatusInvalidDb

An error occurred in the service while attempting a database operation. Communication with the database failed

for various reasons.

WorkflowHostUnavailable

The task could not be started because the database connection is inactive.

PermissionDenied

The user does not have administrative rights to perform this operation.

ConfigurationLoggingError

The operation could not be performed because of a configuration logging error

CommunicationError

An error occurred while communicating with the service.

InvalidParameterCombination

Both PurgeJobOnSuccess and RunAsynchronously were specified.

When running asynchronously, the cmdlet terminates before the job does,

so it cannot clean up the completed job.

PermissionDenied

The user does not have administrative rights to perform this operation.

ExceptionThrown

An unexpected error occurred. For more details, see the Windows event logs

on the controller being used, or Citrix Virtual Apps and Desktops logs.

New-ProvVM