Previous Topic: dpmhv-importVMEx (Funclet) Command--Copy and Import VMNext Topic: dpmhv-setVMClustered (Cmdlet) Command--Set a VM in a Cluster


dpmhv-setSysprepProperties (Cmdlet) Command--Create a Virtual Disk

The dpmhv-setSysprepProperties command lets you create a virtual disk image.

This command has the following format:

dpmhv-setSysprepProperties 
-host hostname 
-vm vmname|-vmid vmguid|-jobref job 
[-computerName computerName] 
[-ip4addr ip4addr] 
[-ip4dhcp ip4dhcpInt] 
[-ip4mask ip4mask] 
[-ip4gw ip4gw] 
[-ip4metric ip4metric] 
[-ip4dns ip4dns]
[-disableAdmin] 
[-adminPass adminPW] 
[-autoLogon alcnt]
[-duplicatorString dupstr]
[-timeZone timezone]
[-productKey key]
[-userName UserName]
[-organization orgname>]
[-domain domname]
[-domainAdmin domad] 
[-domainAdminPass dompw]
[-workgroup wgname]
[-adminUser adminUser]
[-adminUserPass adminUserPW]
[-custom custom]
-host hostname

Specifies the name of the Hyper-V server host.

Default: $$HVHost

-vm vmname

Specifies the name of the VM.

-vmid vmguid

Specifies the unique ID of the VM.

-jobref job

Specifies the job ID of an asynchronous job.

Note: Upon the complete execution of asynchronous job, Hyper-V holds the job information for few minutes (five) only, beyond which it becomes invalid.

-computerName computerName

(Optional) Specifies the name of the computer. Support for this parameter requires an image using Sysprep tool. This option is invalid for asynchronous execution of the command.

Default: Null

-ip4addr ip4addr

(Optional) Specifies the static IPv4 address that you want to assign to an interface of the VM. To set an IP address for a specific interface, the IP address is prefixed with known interface name and '#' as separator. For example,
-ip4addr "Local Area Connection#192.168.1.200". If the template image has more than one network adaptor, the IP address is assigned to the first interface. This option is invalid for asynchronous execution of the command.

Default: ""

-ip4dhcp ip4dhcpInt

(Optional) Specifies an option to turn on DHCP of a particular interface of the VM. You can also specify the interface name for this option. For example,
-ip4dhcp "Local Area Connection." If the template image has more than one network adaptor, DHCP is turned on for the first interface. This option is invalid for asynchronous execution of the command.

Default: local

-ip4mask ip4mask

(Optional) Specifies the subnet mask that you want to assign for the VM. This option is used with
-ip4ddr option. If an interface name is specified in the
-ip4addr option, same interface name must be used in this option. Support for this parameter requires a Windows image created using Sysprep tool. This option is invalid for asynchronous execution of the command.

Default: ""

-ip4gw ip4gw

(Optional) Specifies the option to set the gateway for VM. This option is used with -ip4ddr option. Support for this parameter requires a Windows image created using Sysprep tool. This option is invalid for asynchronous execution of command.

Note: If an interface name is specified in the
-ip4addr option, same interface name must be used in this option.

Default: ""

-ip4metric ip4metric

(Optional) Specifies the interface metric that you want to set for the VM. This option is used with -ip4ddr option. If an interface name is specified in the
-ip4addr option, same interface name must be used in this option. Support for this parameter requires a Windows image created using Sysprep tool. This option is invalid for asynchronous execution of command.

Default: 1

-ip4dns ip4dns

(Optional) Specifies the DNS server that you want to set for the VM. This option is used with -ip4ddr option. If an interface name is specified in the
-ip4addr option, same interface name must be used in this option. Support for this parameter requires a Windows image created using Sysprep tool. This option is invalid for asynchronous execution of command.

Default: ""

-disableAdmin

(Optional) Specifies an option to disable default administrator account for the VM. Support for this parameter requires a Windows image created using Sysprep tool. This option is invalid for asynchronous execution of command.

-adminPass adminPW

(Optional) This option is used to set the default administrator account password for the VM. Support for this parameter requires a Windows image created using Sysprep tool. This parameter is ignored in asynchronous execution.

Note: To set this option successfully, set the Windows Server 2003 administrator password which is created using Sysprep tool as empty.

Default: Null

-autoLogon alcnt

(Optional) Specifies an option to set the number of accounts that you want to create to log in automatically with default administrator account. The accounts are created after the completion of Sysprep process. hyperv_sp_dupstr. Support for this parameter requires a Windows image created using Sysprep tool. This option is invalid for asynchronous execution of command.

Default:
-1

-duplicatorString dupstr

(Optional) Specifies the name of the system duplicator that you want to set in the registry of the VM. Support for this parameter requires a Windows image created using Sysprep tool. This option is invalid for asynchronous execution of command.

Default: Null

-timeZone timezone

(Optional) Specifies the time zone used by the VM that are created using the template. Support for this parameter requires a Windows image created using Sysprep tool. This option is invalid for asynchronous execution of command.

Default:
-1

-productKey key

(Optional) Specifies the Windows product activation key for the VM. Support for this parameter requires a Windows image created using Sysprep tool. This option is invalid for asynchronous execution of command.

Default: Null

-userName UserName

(Optional) Specifies the user name of the Windows inside the VM is licensed to. Support for this parameter requires a Windows image created using Sysprep tool. This option is invalid for asynchronous execution of command.

Default: Null

-organization orgname

(Optional) Specifies the organization the Windows copy inside the VM is licensed to. Support for this parameter requires a Windows image created using Sysprep tool. This option is invalid for asynchronous execution of command.

Default: Null

-domain domainname

(Optional) Specifies the domain name for the VM. Support for this parameter requires a Windows image created using Sysprep tool. This option is invalid for asynchronous execution of command. Domain and workgroup specifications are mutually exclusive.

Default: Null

-domainAdmin domad

(Optional) Specifies the user account as Domain Administrator that you want to create in the domain. Support for this parameter requires a Windows image created using Sysprep tool. This option is invalid for asynchronous execution of command.

Default: Null

-domainAdminPass dompw

(Optional) Specifies the password for Domain Administrator user account that you want to create in the domain. Support for this parameter requires a Windows image created using Sysprep tool. This option is invalid for asynchronous execution of command.

Default: Null

-workgroup wgname

(Optional) Specifies the workgroup that you want to create for the VM. Support for this parameter requires a Windows image created using Sysprep tool. Domain and workgroup specifications are mutually exclusive. This option is invalid for asynchronous execution of command.

Default: Null

-adminUser adminUser

(Optional) Specifies the administrator user name that you want to create as a part of the default Administrators group. Support for this parameter requires a Windows image created using Sysprep tool. This option is invalid for asynchronous execution of command.

Default: Null

-adminUserPass adminUserPW

(Optional) Specifies the password of the administrator user account that you want to create as a part of the default Administrators group. Support for this parameter requires a Windows image created using Sysprep tool. This option is invalid for asynchronous execution of command.

Default: Null

-custom custom

(Optional) Specifies the list of comma-separated custom commands that you want to execute at the end of Sysprep process. This parameter requires Windows image of Sysprep. This parameter is ignored in asynchronous execution.

Default: Null

Return Value

The dpmhv-setSysprepProperties command returns an empty string when it is executed synchronously. If executed asynchronously, a string representing job ID is passed to dpmhv-getJobErrorInfo, dpmhv-getJobInfo, or dpmhv-getJobStatus. If an error occurs during execution, an exception is reported.

Example: Create a Virtual Disk

This example creates a dynamic virtual 2GB disk.

dpmhv-createVirtDisk -host hvserver -path C:\VMDisks\hdd.vhd -type dynamic -sizeGB 2