Citrix Virtual Apps and Desktops SDK

New-Provvm

Creates a new virtual machine.

Syntax

New-ProvVM -ProvisioningSchemeName <String> -ADAccountName <String[]> [-FastBuild] [-NetworkMapping <Hashtable>] [-AutoAssignVLAN] [-SecurityGroup <String[]>] [-MachinesPerAssistant <Int32>] [-MaxAssistants <Int32>] [-RunAsynchronously] [-PurgeJobOnSuccess] [-LoggingId <Guid>] [-BearerToken <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>] [-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 is used in a round robin mechanism. For the duration of this task, the AD accounts are locked (by the AD Identity Service), which stops the same accounts being used by other virtual machine creation tasks.

Parameters

Name Description Required? Pipeline Input Default Value
ProvisioningSchemeName The name of the provisioning scheme in which the virtual machines are created. true false  
ProvisioningSchemeUid The unique identifier for the provisioning scheme in which the virtual machines are created. true false  
ADAccountName A list of the Active Directory account names that are used for the virtual machines. 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 or not the command can improve speed by using optimizations in the creation process. This may mean that machines you create cannot be booted 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 or not 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 or not the command returns before it is complete. 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 has finished. This cannot be specified for tasks that are 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  
AdminAddress Specifies the address of a XenDesktop 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.
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.
Active <Boolean>
Indicates Whether The Task Is Still Processing Or Is Complete.
Host <String>
The Name Of The Host On Which The Task Is Running Or Was Run.
Datestarted <Datetime>
The Date And Time That The Task Was Initiated.
Type <Citrix.Xdinterservicetypes.Jobtype>
The Type Of Task. For Newly Provisioned Vm Tasks, This Is Always “Newvirtualmachine”.
Metadata <Citrix.Machinecreation.Sdk.Metadata[]>
The List Of Metadata Stored Against The Task. For New Tasks This Is Empty Until Metadata Is Added.
Workflowstatus <System.Workflow.Runtime.Workflowstatus>
Indicates The Status Of The Workflow That Is Used To Process The Task.
Provisioningschemename <String>
The Name Of The Provisioning Scheme That The Task Was For.
Provisioningschemeuid <Guid>
The Unique Identifier Of The Provisioning Scheme That The Task Was For.
Masterimage <String>
The Path (In The Hosting Unit Provider) Of The Virtual Machine Snapshot That Was Used As The Master Image For The Task.
Identitypoolname <String>
The Name Of The Identity Pool (From The Adidentity Powershell Snap-In) That The New Provisioning Scheme Uses.
Identitypooluid <Guid>
The Unique Identifier Name Of The Identity Pool (From The Adidentity Powershell Snap-In) That The New Provisioning Scheme Uses.
Hostingunitname <String>
The Name Of The Hosting Unit (From The Hosting Unit Powershell Snap-In) That The New Provisioning Scheme Uses.
Hostingunituid
The Unique Identifier Of The Hosting Unit (From The Hosting Unit Powershell Snap-In) That The New Provisioning Scheme Uses.
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.
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.
Failedvirtualmachines <Citrix.Desktopupdatemanager.Sdk.Virtualmachinecreation[]>
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>
Statusadditionalinformation <String>
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.
Createdvirtualmachines <Citrix.Desktopupdatemanager.Sdk.Virtualmachinecreation[]>
See Failedvirtualmachines For Details Of The Object Parameters.

Notes

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. To locate more details, see the Windows event logs
on the controller being used, or examine the XenDesktop logs.
The cmdlet is associated with a task of type NewVirtualMachine, and while active will move through the following operations (CurrentOperation field)
ValidatingInputs
CreatingVirtualMachines
ReleasingAccountLocks

Examples

Example 1

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

TaskId                             : 4b49f13a-277c-4cb0-bc40-f088430cfe8a

Active                             : False

Host                               : DUMTESTDDC

DateStarted                        : 18/05/2010 10:54:32

Type                               : NewVirtualMachine

Metadata                           : {}

WorkflowStatus                     : Completed

MasterImage                        : /Base.vm/Base.snapshot

ProvisioningSchemeName             : MyScheme

ProvisioningSchemeUid              : 7585f0de-192e-4847-a6d8-22713c3a2f42

CurrentOperation                   :

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              : {}

ProvisioningJob                    : 6fa5dc7c-6d49-4616-8682-aeb1580866b3

ProvisioningStatus                 : Completed
<!--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><br>i.e.<br>C:\PS>Get-ProvTask -TaskID 6dd85fec-96cf-46b1-9cd4-d8ba7d06e85b<br>TaskId : 4b49f13a-277c-4cb0-bc40-f088430cfe8a<br>Active : False<br>Host : MyHost<br>DateStarted : 18/05/2010 10:54:32<br>Type : NewVirtualMachine<br>Metadata : {}<br>WorkflowStatus : Completed<br>MasterImage : /Base.vm/Base.snapshot<br>ProvisioningSchemeName : MyScheme<br>ProvisioningSchemeUid : 7585f0de-192e-4847-a6d8-22713c3a2f42<br>TaskState : Finished<br>TaskStateInformation :<br>HostingUnitUid : 01a4a008-8ce8-4165-ba9c-cdf15a6b0501<br>HostingUnitName : XenHU<br>IdentityPoolUid : 03743136-e43b-4a87-af74-ab71686b3c16<br>IdentityPoolName : idPool1<br>VirtualMachinesToCreateCount : 1<br>VirtualMachinesCreatedCount : 1<br>VirtualMachinesCreationFailedCount : 0<br>CreatedVirtualMachines : {DOMAIN\Account$}<br>FailedVirtualMachines : {}<br>ProvisioningJob : 6fa5dc7c-6d49-4616-8682-aeb1580866b3<br>ProvisioningStatus : Completed

Example 3

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

C:\PS>New-provVM -ProvisioningSchemeName MyScheme -ADAccountName $t -RunAsyncronously
<!--NeedCopy-->

Description

Creates a new virtual machine 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><br>For example:<br>C:\PS>Get-ProvTask -TaskID 6dd85fec-96cf-46b1-9cd4-d8ba7d06e85b<br>TaskId : 4b49f13a-277c-4cb0-bc40-f088430cfe8a<br>Active : False<br>Host : MyHost<br>DateStarted : 18/05/2010 10:54:32<br>Type : NewVirtualMachine<br>Metadata : {}<br>WorkflowStatus : Completed<br>MasterImage : /Base.vm/Base.snapshot<br>ProvisioningSchemeName : MyScheme<br>ProvisioningSchemeUid : 7585f0de-192e-4847-a6d8-22713c3a2f42<br>TaskState : Finished<br>TaskStateInformation :<br>HostingUnitUid : 01a4a008-8ce8-4165-ba9c-cdf15a6b0501<br>HostingUnitName : XenHU<br>IdentityPoolUid : 03743136-e43b-4a87-af74-ab71686b3c16<br>IdentityPoolName : idPool1<br>VirtualMachinesToCreateCount : 1<br>VirtualMachinesCreatedCount : 1<br>VirtualMachinesCreationFailedCount : 0<br>CreatedVirtualMachines : {DOMAIN\Account$}<br>FailedVirtualMachines : {}<br>ProvisioningJob : 6fa5dc7c-6d49-4616-8682-aeb1580866b3<br>ProvisioningStatus : Completed

New-Provvm