You are on page 1of 15

Clone, Windows with single NIC

Clone, Windows with single NIC


Clones a Windows virtual machine, performs guest operating system
customization and configures one virtual network card.
Sysprep tools must be available on vCenter Server system.

1. Versions
Version

Date

0.2.1

User

Nov 6, 2013

Internal

Comment

Imported from content from package

Current version:0.2.1

2. Inputs
Name

Type

Description

folder*

VC:VmFolder

Virtual machine folder

name*

string

New virtual machine name

vm*

VC:VirtualMachine

Virtual machine to clone

powerOn*

boolean

Specifies whether or not to power


on the new virtual machine

template*

boolean

Specifies whether or not to mark


the new virtual machine as a
template

datastore*

VC:Datastore

Datastore in which to store the


virtual machine. If not specified,
the current datastore is used

host

VC:HostSystem

(Optional) Host on which to create


the virtual machine

pool

VC:ResourcePool

(Optional) Resource pool in which


to create the virtual machine

doSysprep

boolean

Run the Sysprep operations and wait


for the task to complete. Not used
if the virtual machine is marked as
template

vCO Workflow Documentation - Dec 1, 2013

Page

Clone, Windows with single NIC


Name

clientName*

Type

string

Description

Name or prefix name of the Windows


client

productId*

string

Microsoft Sysprep requires that a


valid serial number be included in
the answer file when mini-setup
runs. This serial number is ignored
if the original guest operating
system was installed using a
volume-licensed CD

joinDomain

string

(Optional) The domain that the


virtual machine should join. If
this value is supplied, then
domainAdmin and domainAdminPassword
must also be supplied, and the
workgroup name must be empty

joinWorkgroup

string

(Optional) The workgroup that the


virtual machine should join. If
this value is supplied, then the
domain name and authentication
fields must be empty

domainAdmin*

string

(Optional) This is the domain user


account used for authentication if
the virtual machine is joining a
domain. The user does not need to
be a domain administrator, but the
account must have the privileges
required to add computers to the
domain

domainAdminPassword*

string

The password string. It is


encrypted if the associated
plainText flag is false

licenseMode*

VC:CustomizationLic Server licensing mode


enseDataMode

licenseUsers*

number

This key is valid only if AutoMode


= PerServer

vCO Workflow Documentation - Dec 1, 2013

Page

Clone, Windows with single NIC


Name

newAdminPassword*

Type

string

Description

The password string. It is


encrypted if the associated
plainText flag is false

inTimezone*

Enums:MSTimeZone

Timezone for the newly created


virtual machine

network

VC:Network

Network on which to attach the


virtual network interface

dnsServerList

Array/string

(Optional) List of DNS servers for


a virtual network adapter with a
static IP address

dnsDomain

string

(Optional) DNS domain suffix such


as vmware.com

dhcp*

boolean

Use a DHCP server to configure the


virtual network adapter

gateway

Array/string

(Optional) List of gateways, in


order of preference

ipAddress

string

Fixed valid IP address

macAddress

string

(Optional) The MAC address of a


network adapter being customized.
If it is not included, the
customization process maps the
settings from the virtual machine's
network adapters, in PCI slot order

netBIOS

primaryWINS

VC:CustomizationNet (Optional) NetBIOS setting for


BIOSMode

Windows

string

(Optional) The IP address of the


primary WINS server. This property
is ignored for Linux guest
operating systems

secondaryWINS

string

(Optional) The IP address of the


secondary WINS server. This
property is ignored for Linux guest
operating systems

vCO Workflow Documentation - Dec 1, 2013

Page

Clone, Windows with single NIC


Name

subnetMask

Type

string

Description

(Optional) Subnet mask for this


virtual network adapter

orgName*

string

Organization name

fullName*

string

User's full name

*Parameter is mandatory

3. Outputs
Name

newVM

Type

VC:VirtualMachine

Description

The newly created virtual machine

4. Attributes
Name

Type

Description

task

VC:Task

Task to await

progress

boolean

Log progress while waiting for the


task to complete

pollRate

number

Polling rate for the task state, in


seconds

spec

Any

Specifies how to clone the virtual


machine
(VimVirtualMachineCloneSpec)

location

Any

Specifies the location of resources


the cloned virtual machine will be
using (VirtualMachineRelocateSpec)

customization

Any

Optional guest operating system


customization specification
(CustomizationSpec)

globalIPSettings

Any

Global IP settings constitute the


IP settings that are not specific
to a particular virtual network
adapter
(VimCustomizationGlobalIPSettings)

vCO Workflow Documentation - Dec 1, 2013

Page

Clone, Windows with single NIC


Name

identity

Type

Any

Description

Network identity and settings,


similar to Microsoft's Sysprep
tool. This is a Sysprep, LinuxPrep,
or SysprepText object
(VimCustomizationIdentitySettings)

nicSettingMaps

Array/Any

(Optional) IP settings that are


specific to a particular virtual
network adapter (an array of
VimCustomizationAdapterMapping)

options

Any

Optional operations
(VimCustomizationOptions:
LinuxOptions or WinOptions)

autoLogon

boolean

Flag to determine whether or not


the machine automatically logs on
as Administrator

timeZone

number

The time zone for the new virtual


machine. Numbers correspond to time
zones listed in sysprep
documentation

adapterMapping

Any

Data object type to associate a


virtual network adapter with its IP
settings

startVm

boolean

Specifies whether to start the


cloned virtual machine. Depends on
the values set for 'template',
'doSysprep' and 'powerOn'
attributes

tempNewVm

VC:VirtualMachine

The newly created virtual machine

pollingRate

number

Polling rate for the task state, in


seconds

timeout

number

Timeout period to elapse before


throwing a timeout exception, in
minutes

sourceVirtualEthernetCa Any

The VirtualEthernetCard the

rd

template defines

vCO Workflow Documentation - Dec 1, 2013

Page

Clone, Windows with single NIC


Name

virtualEthernetCard

Type

Description

Any

The VirtualEthernetCard instance


the virtual machine uses

config

Any

(Optional) Specification of changes


to the virtual hardware
(VirtualMachineConfigSpec)

deviceChange

Array/Any

(Optional) Set of virtual devices


being modified by the configuration
operation (an array of
VirtualDeviceConfigSpec)

addNumberToName

boolean

Append a number to the client name


to ensure the name is unique

nicPosition

number

Specifies which network card to


use. If no valid value, the first
network card is used

targetDatastore

VC:Datastore

Datastore in which to store the


virtual machine

templateAttr

boolean

Specifies whether or not to mark


the new virtual machine as a
template

5. Parameter
Parameter

vm

presentation
Description

Virtual machine to

Parameter Info

Mandatory input: true

clone
name

Name of the new

Mandatory input: true

virtual machine
template

Mark the new

Mandatory input: true

virtual machine as
a template
powerOn

Power on the new

Mandatory input: true

virtual machine
pool

Resource pool

vCO Workflow Documentation - Dec 1, 2013

Page

Clone, Windows with single NIC


Parameter

Description

host

Host

folder

Virtual machine

Parameter Info

Mandatory input: true

folder
datastore

Datastore in which

Mandatory input: false

to store the
virtual machine. If
not specified, the
current datastore
is used
fullName

User's full name

Mandatory input: true

orgName

Organization name

Mandatory input: true

doSysprep

Run the Sysprep

Default value: !#template

operations and wait


for the task to
complete. Not used
if the virtual
machine is marked
as template
clientName

Name or prefix name Mandatory input: true


of the Windows
client

newAdminPassword

New local

Mandatory input: true

administrator
password
inTimezone

Timezone for the

Mandatory input: true

newly created
virtual machine
productId

Windows key

Mandatory input: false

(ignored if
template key is
VLK)

vCO Workflow Documentation - Dec 1, 2013

Page

Clone, Windows with single NIC


Parameter

licenseMode

Description

Server licensing
mode

licenseUsers

Number of licenses
(only if License

Parameter Info

Mandatory input: true


Default value:
dunes://service.dunes.ch/CustomSDKO
bject?id='perSeat'&dunesName='VC:Cu
stomizationLicenseDataMode'
Mandatory input: true
Default value: 5.0

mode = PerServer)
joinDomain

Domain name to join

joinWorkgroup

Workgroup name to
join

domainAdmin

Domain user account Mandatory input: #joinDomain !=


used for

null && #joinDomain != ""

authentication if
the virtual machine
is joining a domain
domainAdminPassword Password string to
access the domain
macAddress

Mandatory input: #joinDomain !=


null && #joinDomain != ""

The MAC address of


a network adapter
being customized

network

Network on which to Default value:


network interface

GetAction("com.vmware.library.vc.vm
.network","getNetworkForGivenNic").
call( #vm , 1.0)

Use a DHCP server

Mandatory input: true

attach the virtual

dhcp

to configure the
virtual network
adapter
ipAddress

Fixed valid IP
address

subnetMask

Subnet mask for


this virtual
network adapter

vCO Workflow Documentation - Dec 1, 2013

Page

Clone, Windows with single NIC


Parameter

gateway

Description

Parameter Info

List of gateways,
in order of
preference

dnsDomain

DNS domain suffix


such as vmware.com

dnsServerList

List of DNS servers


for a virtual
network adapter
with a static IP
address

netBIOS

NetBIOS setting for


Windows

primaryWINS

The IP address of
the primary WINS
server

secondaryWINS

The IP address of
the secondary WINS
server

6. Workflow

schema

vCO Workflow Documentation - Dec 1, 2013

Page

Clone, Windows with single NIC

7. Workflow
Name

checkVMwareI

items
Type

WorkflowItemTask

nput
vim3WaitTask

Next item

Set start
vm?

WorkflowItemTask

Set ouput vm

End
cloneVM

Description

Wait a VIM 3 Task to end.


When task ended, return the

WorkflowItemTask

vim3WaitTask
End

getCloneSpec

WorkflowItemTask

vCO Workflow Documentation - Dec 1, 2013

cloneVM

Page

10

Clone, Windows with single NIC


Name

Get Windows

Type

WorkflowItemLink

Customizatio

Next item

Description

Get 1 Nic
Setting Map

n (Sysprep)
getRelocateS

WorkflowItemTask

pec
getCustomiza

er
WorkflowItemTask

tionSpec
getCustomiza

getNicByNumb

getRelocateS
pec

WorkflowItemTask

Get Windows

tionGlobalIP

Customizatio

Settings

n (Sysprep)

Get 1 Nic

WorkflowItemLink

Nic -> Nic[]

WorkflowItemTask

getCustomiza

Setting Map
Nic -> Nic[]

tionSpec
Get Timezone

WorkflowItemTask

in Number

getCustomiza
tionGlobalIP
Settings

Set start

WorkflowItemTask

vm?
Template?

Set ouput vm

Get Timezone
in Number

WorkflowItemGeneri Mark as
cCondition

Template

WorkflowItemTask

Template?

WorkflowItemEnd
Do sysprep?

WorkflowItemGeneri vim3WaitDnsN
cCondition

ameInTools

WorkflowItemEnd
Power on?

WorkflowItemGeneri
cCondition
WorkflowItemEnd
WorkflowItemEnd

vCO Workflow Documentation - Dec 1, 2013

Page

11

Clone, Windows with single NIC


Name

Get a

Type

WorkflowItemLink

Next item

Description

Get Device[]

VirtualEther
netCard to
change the
network
Nic found?

Get Device[]

WorkflowItemGeneri Network
cCondition

defined

WorkflowItemTask

getConfigSpe
cSimple

getConfigSpe

WorkflowItemTask

getCloneSpec

cSimple

The ConfigSpec data object type


encapsulates configuration
settings when creating or
reconfiguring a virtual machine.
To support incremental changes,
these properties are all
optional.
Basic Version

vim3WaitDnsN

WorkflowItemTask

Power on?

ameInTools

Wait for a given name in the DNS


guest informations (VMware
tools).
Exception:
- Timeout: When timeout is
reached

getNicByNumb

WorkflowItemTask

er

Nic found?

Return a Network card device


(VimVirtualE1000,
VimVirtualVmxnet,
VimVirtualPCNet32). The network
position let you choose if you
want to get the 1st, 2nd... 5th
network card.

Shutdown

WorkflowItemLink

Shutdown guest OS and wait.

guest OS and
wait

vCO Workflow Documentation - Dec 1, 2013

Page

12

Clone, Windows with single NIC


Name

Type

Next item

Network

WorkflowItemGeneri Get a

defined

cCondition

Description

VirtualEther
netCard to
change the
network

Set

WorkflowItemTask

datastore if

checkVMwareI
nput

null
Mark as

WorkflowItemLink

Template

8. Source

Mark an existing VM as a
template, preventing it to start

code for the used actions

8.1. checkVMwareInput
//Auto generated script, cannot be modified !
System.getModule("com.vmware.library.vc.vm.spec").checkVMwareInput(vm,folder,datastore,hos
t,pool) ;

8.2. vim3WaitTaskEnd
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.library.vc.basic").vim3WaitTaskEnd(task,progress,pollRate) ;

8.3. cloneVM
//Auto generated script, cannot be modified !
actionResult = System.getModule("com.vmware.library.vc.vm").cloneVM(vm,folder,name,spec) ;

8.4. getCloneSpec
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.library.vc.vm.spec").getCloneSpec(config,customization,locati
on,powerOn,template) ;

8.5. getRelocateSpec

vCO Workflow Documentation - Dec 1, 2013

Page

13

Clone, Windows with single NIC

//Auto generated script, cannot be modified !


actionResult =
System.getModule("com.vmware.library.vc.vm.spec").getRelocateSpec(datastore,disk,host,pool
,transform) ;

8.6. getCustomizationSpec
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.library.vc.vm.spec").getCustomizationSpec(globalIPSettings,id
entity,nicSettingMap,options) ;

8.7. getCustomizationGlobalIPSettings
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.library.vc.vm.spec").getCustomizationGlobalIPSettings(dnsServ
erList,dnsSuffixList) ;

8.8. Nic -> Nic[]


nicSettingMaps = new Array(adapterMapping);

8.9. Get Timezone in Number


timeZone = inTimezone.id;

8.10. Set start vm?


if (template) {
startVm = false;
}
else if (doSysprep) {
startVm = true;
}
else {
startVm = powerOn;
}

8.11. Set ouput vm

vCO Workflow Documentation - Dec 1, 2013

Page

14

Clone, Windows with single NIC


newVM = tempNewVm;

8.12. Get Device[]


var deviceChange = new Array();
var change = new VcVirtualDeviceConfigSpec();
change.device = virtualEthernetCard;
change.operation = VcVirtualDeviceConfigSpecOperation.edit;
deviceChange.push(change);

8.13. getConfigSpecSimple
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.library.vc.vm.spec").getConfigSpecSimple(deviceChange,files,f
lags,memoryMB,name,numCPUs) ;

8.14. vim3WaitDnsNameInTools
//Auto generated script, cannot be modified !
System.getModule("com.vmware.library.vc.vm.tools").vim3WaitDnsNameInTools(vm,pollingRate,d
nsNameToWait,timeout,addNumberToName) ;

8.15. getNicByNumber
//Auto generated script, cannot be modified !
actionResult =
System.getModule("com.vmware.library.vc.vm.network").getNicByNumber(vm,nicPosition) ;

8.16. Set datastore if null


if (datastore != null) {
targetDatastore = datastore;
}
else {
targetDatastore = vm.datastore[0];
}

vCO Workflow Documentation - Dec 1, 2013

Page

15

You might also like