Citrix Virtual Apps and Desktops 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>] [-BearerToken <String>] [-TraceParent <String>] [-TraceState <String>] [-VirtualSiteId <String>] [-AdminAddress <String>] [<CommonParameters>]

New-ProvVM -ProvisioningSchemeUid <Guid> -ADAccountName <String[]> [-FastBuild] [-NetworkMapping <Hashtable>] [-AutoAssignVLAN] [-SecurityGroup <String[]>] [-MachinesPerAssistant <Int32>] [-MaxAssistants <Int32>] [-RunAsynchronously] [-PurgeJobOnSuccess] [-LoggingId <Guid>] [-BearerToken <String>] [-TraceParent <String>] [-TraceState <String>] [-VirtualSiteId <String>] [-AdminAddress <String>] [<CommonParameters>]

<!--NeedCopy-->

Detailed 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.

Parameters

Name Description Required? Pipeline Input Default Value
ProvisioningSchemeName The name of the provisioning scheme in which the VMs are created. true false  
ProvisioningSchemeUid The unique identifier of the provisioning scheme in which the VMs are created. true 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”. true 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. false 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. false 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 false false false
SecurityGroup The security groups to apply to machines created in Cloud Hypervisors. false false  
MachinesPerAssistant The number of concurrent volume operations that may be performed by each volume worker helper machine. false false  
MaxAssistants The maximum number of volume worker help machines that may be created for this operation. false 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. false false 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. false 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. false false  
BearerToken Specifies the bearer token assigned to the calling user false false  
TraceParent Specifies the trace parent assigned for internal diagnostic tracing use false false  
TraceState Specifies the trace state assigned for internal diagnostic tracing user false false  
VirtualSiteId Specifies the virtual site the PowerShell snap-in will connect to. false false  
AdminAddress The address of a Citrix Virtual Apps and Desktops controller to which the PowerShell snap-in connects. You can provide this as a host name or an IP address. false false LocalHost. Once a value is provided by any cmdlet, this value becomes the default.

Input Type

Return Values

System.Guid

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

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.

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.

Examples

Example 1


C:\PS>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-->

Description

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

Example 2


C:\PS>New-ProvVM -ProvisioningSchemeName MyScheme -ADAccountName "domain\Account" -RunAsynchronously

Guid

----

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

<!--NeedCopy-->

Description

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> i.e.

Example 3


C:\PS>$accounts = Get-AcctAdAccount -IdentityPool MyPool -State Available

C:\PS>New-ProvVM -ProvisioningSchemeName MyScheme -ADAccountName $t -RunAsyncronously

<!--NeedCopy-->

Description

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> For example:

New-ProvVM