<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:clearspace="http://www.jivesoftware.com/xmlns/clearspace/rss" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>VMware Communities: Message List - Change VM ip address</title>
    <link>http://communities.vmware.com/community/vmtn/vsphere/automationtools/windows_toolkit?view=discussions</link>
    <description>Most recent forum messages</description>
    <language>en</language>
    <pubDate>Wed, 09 Sep 2009 14:00:41 GMT</pubDate>
    <generator>Clearspace 1.10.12 (http://jivesoftware.com/products/clearspace/)</generator>
    <dc:date>2009-09-09T14:00:41Z</dc:date>
    <dc:language>en</dc:language>
    <item>
      <title>Re: Change VM ip address</title>
      <link>http://communities.vmware.com/message/1358990?tstart=0#1358990</link>
      <description>Thanks for the update. I feel your pain -- I know how much 'fun' it was to strip away the pieces of the Customization Spec to get to just the IP address part.  &lt;br /&gt;
&lt;br /&gt;
I wonder if the requirements have somethign to do with the version of sysprep that gets kicked off, since I'm pretty sure I didn't have to set the AutoMode parameter.</description>
      <pubDate>Wed, 09 Sep 2009 14:00:41 GMT</pubDate>
      <author>DougBaer</author>
      <guid>http://communities.vmware.com/message/1358990?tstart=0#1358990</guid>
      <dc:date>2009-09-09T14:00:41Z</dc:date>
      <clearspace:dateToText>2 months, 2 weeks ago</clearspace:dateToText>
    </item>
    <item>
      <title>Re: Change VM ip address</title>
      <link>http://communities.vmware.com/message/1358798?tstart=0#1358798</link>
      <description>&lt;br /&gt;
Hi DougBaer,&lt;br /&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;p /&gt;
The problem had nothing to do with vSphere or VI3.5, the posted code apperantly missed a mandatory sysprep field (in my situation, anyway).&lt;br /&gt;
I had to add these lines:&lt;br /&gt;
&lt;p /&gt;
$cust_sysprep.LicenseFilePrintData = New-Object VMware.Vim.CustomizationLicenseFilePrintData &lt;br /&gt;
$cust_sysprep.LicenseFilePrintData.AutoMode = "perseat"&lt;br /&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;p /&gt;
Thanks any way for the great code !!&lt;br /&gt;
&lt;p /&gt;
Tested it out and works fine except for the part that it plays with the domain/workgroup, where I 'm only interessed in changing IP.&lt;br /&gt;
So I follow you advise and go for launching a Powershell script in the VM that does the job&lt;br /&gt;
&lt;p /&gt;
Tx&lt;br /&gt;
Christof&lt;br /&gt;
&lt;p /&gt;
 The slightly modified code:&lt;br /&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;p /&gt;
$vm = Get-VM $name&lt;br /&gt;
$cg = New-Object VMware.Vim.CustomizationGlobalIPSettings&lt;br /&gt;
$cg.DnsServerList = $dns&lt;br /&gt;
$cg.DnsSuffixList = $domain&lt;br /&gt;
&lt;p /&gt;
$cfi = New-Object VMware.Vim.CustomizationFixedIp&lt;br /&gt;
$cfi.IpAddress = $ip&lt;br /&gt;
&lt;p /&gt;
$cis = New-Object VMware.Vim.CustomizationIPSettings&lt;br /&gt;
$cis.DnsDomain = $domain&lt;br /&gt;
$cis.DnsServerList = $dns&lt;br /&gt;
$cis.Ip = $cfi&lt;br /&gt;
$cis.Gateway = $gateway&lt;br /&gt;
$cis.SubnetMask = $subnetmask&lt;br /&gt;
&lt;p /&gt;
$cm = New-Object VMware.Vim.CustomizationAdapterMapping&lt;br /&gt;
$cm.Adapter = $cis&lt;br /&gt;
&lt;p /&gt;
$customspec = New-Object Vmware.Vim.CustomizationSpec&lt;br /&gt;
$customspec.GlobalIPSettings = $cg&lt;br /&gt;
&lt;p /&gt;
$cust_name = New-Object Vmware.Vim.CustomizationFixedName&lt;br /&gt;
$cust_name.Name = $vmname&lt;br /&gt;
&lt;p /&gt;
#Windows&lt;br /&gt;
$cust_sysprep = New-Object Vmware.Vim.CustomizationSysPrep&lt;br /&gt;
$cust_sysprep.GuiUnattended = New-Object VMware.Vim.CustomizationGuiUnattended&lt;br /&gt;
#$cust_sysprep.GuiUnattended.autoLogon = $true&lt;br /&gt;
#$cust_sysprep.GuiUnattended.autoLogonCount = "1"&lt;br /&gt;
&lt;p /&gt;
#$cust_sysprep.GuiUnattended.Password = New-Object VMware.Vim.CustomizationPassword&lt;br /&gt;
#$cust_sysprep.GuiUnattended.Password.plainText = "True"&lt;br /&gt;
#$cust_sysprep.GuiUnattended.Password.value = "password"&lt;br /&gt;
#&lt;br /&gt;
$cust_sysprep.UserData = New-Object VMware.Vim.CustomizationUserData&lt;br /&gt;
$cust_sysprep.UserData.orgName = "Testing"&lt;br /&gt;
$cust_sysprep.UserData.fullName = "Testing"&lt;br /&gt;
#&lt;br /&gt;
$cust_sysprep.UserData.ProductId= "xxxxx-xxxxx-xxxxx-xxxxx-xxxxx"&lt;br /&gt;
&lt;p /&gt;
&lt;b&gt;$cust_sysprep.LicenseFilePrintData = New-Object VMware.Vim.CustomizationLicenseFilePrintData&lt;/b&gt; &lt;br /&gt;
&lt;b&gt;$cust_sysprep.LicenseFilePrintData.AutoMode = "perseat"&lt;/b&gt;&lt;br /&gt;
&lt;p /&gt;
&lt;br /&gt;
$cust_sysprep.UserData.ComputerName = New-Object VMware.Vim.CustomizationFixedName&lt;br /&gt;
$cust_sysprep.UserData.ComputerName.name = $vmname&lt;br /&gt;
#&lt;br /&gt;
$cust_sysprep.Identification = New-Object VMware.Vim.CustomizationIdentification&lt;br /&gt;
$cust_sysprep.Identification.JoinWorkgroup = "WORKGROUP"&lt;br /&gt;
&lt;p /&gt;
#$cust_sysprep.Options = New-Object VMware.Vim.CustomizationWinOptions&lt;br /&gt;
#$cust_sysprep.Options.changeSID = 0&lt;br /&gt;
&lt;p /&gt;
$customspec.Identity = $cust_sysprep&lt;br /&gt;
$customspec.NicSettingMap = $cm&lt;br /&gt;
&lt;p /&gt;
$vmv = Get-View $vm.Id&lt;br /&gt;
#$vmv = Get-View $vm&lt;br /&gt;
$vmv.CustomizeVM($customspec)&lt;br /&gt;
&lt;p /&gt;
&lt;br /&gt;</description>
      <pubDate>Wed, 09 Sep 2009 11:06:22 GMT</pubDate>
      <author>ugauchr</author>
      <guid>http://communities.vmware.com/message/1358798?tstart=0#1358798</guid>
      <dc:date>2009-09-09T11:06:22Z</dc:date>
      <clearspace:dateToText>2 months, 2 weeks ago</clearspace:dateToText>
      <clearspace:replyCount>1</clearspace:replyCount>
    </item>
    <item>
      <title>Re: Change VM ip address</title>
      <link>http://communities.vmware.com/message/1357845?tstart=0#1357845</link>
      <description>I was using vSphere all the way.  Did you enter your product key in the customization spec? Note that this example only works with Windows VMs, and I was using a Windows 2003 OS.&lt;br /&gt;
&lt;br /&gt;
To me, this is a rather ugly to do it.  I would look at using something like Invoke-VMscript from PowerCLI to change the IP address while the VM is online: &lt;br /&gt;
&lt;br /&gt;
&lt;pre class="jive-pre"&gt;&lt;code class="jive-code jive-plain"&gt;$vm = Get-VM myVM
$gc = Get-Credential 'administrator'
$hc = Get-Credential 'root'
$script = &amp;quot;ipconfig /all&amp;quot;

#Change to static IP address
$script = @&amp;quot;
`$config = gwmi Win32_NetworkAdapterConfiguration
`$adapter = `$config | where { `$_.IPEnabled -eq 'true' }
`$adapter.EnableStatic('172.16.254.51','255.255.255.0')
`$adapter.SetGateways('172.16.254.1')
&amp;quot;@
Invoke-VMScript -vm $vm -ScriptText $script -hostcredential $hc -guestcredential $gc

#Revert all adapters to DHCP
#$script = @&amp;quot;
#`$config = gwmi Win32_NetworkAdapterConfiguration
#`$adapter = `$config | where { `$_.IPEnabled -eq 'true' }
#`$adapter.EnableDHCP()
#&amp;quot;@
#Invoke-VMScript -vm $vm -ScriptText $script -hostcredential $hc -guestcredential $gc
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
You can get some additional information &lt;a class="jive-link-external" href="http://communities.vmware.com/message/1162125#1162125"&gt;here&lt;/a&gt;</description>
      <pubDate>Tue, 08 Sep 2009 14:23:38 GMT</pubDate>
      <author>DougBaer</author>
      <guid>http://communities.vmware.com/message/1357845?tstart=0#1357845</guid>
      <dc:date>2009-09-08T14:23:38Z</dc:date>
      <clearspace:dateToText>2 months, 2 weeks ago</clearspace:dateToText>
      <clearspace:replyCount>2</clearspace:replyCount>
    </item>
    <item>
      <title>Re: Change VM ip address</title>
      <link>http://communities.vmware.com/message/1357621?tstart=0#1357621</link>
      <description>&lt;br /&gt;
Hi Dougbaer,&lt;br /&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;p /&gt;
Did you test your code on VI3 or on vSphere environment?&lt;br /&gt;
&lt;p /&gt;
Don't manage to get it working, do I miss something? &lt;br /&gt;
&lt;p /&gt;
I'm dealing with a SRM project and I have to set my IP address with a script (althoug SRM has an other solution, I know)&lt;br /&gt;
&lt;p /&gt;
My VM is turned of in this phase. &lt;br /&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;p /&gt;
Code starts but get an error back :Exception calling "CustomizeVM" with "1" argument(s): "Customization failed."&lt;br /&gt;
&lt;p /&gt;
All idea are welcome &lt;img src="!" alt="!" class="jive-image"  /&gt;&lt;br /&gt;
&lt;p /&gt;
&lt;br /&gt;
Thanks&lt;br /&gt;
&lt;p /&gt;
Christof &lt;br /&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;p /&gt;
Script i'm testing: &lt;br /&gt;
&lt;p /&gt;
&lt;i&gt;Modified script (two lines (bold))&lt;/i&gt;&lt;br /&gt;
&lt;p /&gt;
 #VM Variables&lt;br /&gt;
#$vmpool = "Testing Pool"&lt;br /&gt;
$vmname =  "w2k3-tst-srv07"&lt;br /&gt;
#$vmtemplate = "winxpsp3"&lt;br /&gt;
#$vmfolder = "DB-Provision"&lt;br /&gt;
#$datastore = "LAB_ESX_Celerra"&lt;br /&gt;
$ip = "192.168.0.101"&lt;br /&gt;
$subnetmask = "255.255.255.0"&lt;br /&gt;
$gateway = "192.168.0.1"&lt;br /&gt;
$dns = "192.168.0.20"&lt;br /&gt;
$domain = "lab.local"&lt;br /&gt;
&lt;br /&gt;
##&lt;br /&gt;
$vm = Get-VM $name&lt;br /&gt;
$cg = New-Object VMware.Vim.CustomizationGlobalIPSettings&lt;br /&gt;
$cg.DnsServerList = $dns&lt;br /&gt;
$cg.DnsSuffixList = $domain&lt;br /&gt;
&lt;br /&gt;
$cfi = New-Object VMware.Vim.CustomizationFixedIp&lt;br /&gt;
$cfi.IpAddress = $ip&lt;br /&gt;
&lt;br /&gt;
$cis = New-Object VMware.Vim.CustomizationIPSettings&lt;br /&gt;
$cis.DnsDomain = $domain&lt;br /&gt;
$cis.DnsServerList = $dns&lt;br /&gt;
$cis.Ip = $cfi&lt;br /&gt;
$cis.Gateway = $gateway&lt;br /&gt;
$cis.SubnetMask = $subnetmask&lt;br /&gt;
&lt;br /&gt;
$cm = New-Object VMware.Vim.CustomizationAdapterMapping&lt;br /&gt;
$cm.Adapter = $cis&lt;br /&gt;
&lt;br /&gt;
$customspec = New-Object Vmware.Vim.CustomizationSpec&lt;br /&gt;
$customspec.GlobalIPSettings = $cg&lt;br /&gt;
&lt;br /&gt;
$cust_name = New-Object Vmware.Vim.CustomizationFixedName&lt;br /&gt;
$cust_name.Name = $vmname&lt;br /&gt;
&lt;br /&gt;
#Windows&lt;br /&gt;
$cust_sysprep = New-Object Vmware.Vim.CustomizationSysPrep&lt;br /&gt;
$cust_sysprep.GuiUnattended = New-Object VMware.Vim.CustomizationGuiUnattended&lt;br /&gt;
$cust_sysprep.GuiUnattended.autoLogon = $true&lt;br /&gt;
$cust_sysprep.GuiUnattended.autoLogonCount = "1"&lt;br /&gt;
&lt;br /&gt;
$cust_sysprep.GuiUnattended.Password = New-Object VMware.Vim.CustomizationPassword&lt;br /&gt;
$cust_sysprep.GuiUnattended.Password.plainText = "True"&lt;br /&gt;
$cust_sysprep.GuiUnattended.Password.value = "password"&lt;br /&gt;
&lt;br /&gt;
$cust_sysprep.UserData = New-Object VMware.Vim.CustomizationUserData&lt;br /&gt;
$cust_sysprep.UserData.orgName = "Testing"&lt;br /&gt;
$cust_sysprep.UserData.fullName = "Testing"&lt;br /&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;#$cust_sysprep.UserData.ProdID = "YOUR PRODUCT KEY HERE"&amp;lt;/code&amp;gt;*$cust_sysprep.UserData.ProductId= "xxxxx-xxxxx-xxxxx-xxxxx-xxxxx"*
&lt;br /&gt;
$cust_sysprep.UserData.ComputerName = New-Object VMware.Vim.CustomizationFixedName&lt;br /&gt;
$cust_sysprep.UserData.ComputerName.name = $vmname&lt;br /&gt;
&lt;br /&gt;
$cust_sysprep.Identification = New-Object VMware.Vim.CustomizationIdentification&lt;br /&gt;
$cust_sysprep.Identification.JoinWorkgroup = "WORKGROUP"&lt;br /&gt;
&lt;br /&gt;
#$cust_sysprep.Options = New-Object VMware.Vim.CustomizationWinOptions&lt;br /&gt;
#$cust_sysprep.Options.changeSID = 0&lt;br /&gt;
&lt;br /&gt;
$customspec.Identity = $cust_sysprep&lt;br /&gt;
$customspec.NicSettingMap = $cm&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;$vmv = Get-View $vm.Id&lt;/b&gt;&lt;br /&gt;
#$vmv = Get-View $vm&lt;br /&gt;
$vmv.CustomizeVM($customspec)</description>
      <pubDate>Tue, 08 Sep 2009 09:32:46 GMT</pubDate>
      <author>bartvp</author>
      <guid>http://communities.vmware.com/message/1357621?tstart=0#1357621</guid>
      <dc:date>2009-09-08T09:32:46Z</dc:date>
      <clearspace:dateToText>2 months, 2 weeks ago</clearspace:dateToText>
      <clearspace:replyCount>3</clearspace:replyCount>
    </item>
    <item>
      <title>Re: Change VM ip address</title>
      <link>http://communities.vmware.com/message/1302604?tstart=0#1302604</link>
      <description>&lt;br /&gt;
Thanks for you reply. Going to test it next Monday. &lt;br /&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;p /&gt;
Have a great weekend &lt;img class="jive-emoticon" border="0" src="http://communities.vmware.com/images/emoticons/wink.gif" alt=";-)" /&gt;</description>
      <pubDate>Sat, 04 Jul 2009 22:20:40 GMT</pubDate>
      <author>ICT-Freak</author>
      <guid>http://communities.vmware.com/message/1302604?tstart=0#1302604</guid>
      <dc:date>2009-07-04T22:20:40Z</dc:date>
      <clearspace:dateToText>4 months, 3 weeks ago</clearspace:dateToText>
    </item>
    <item>
      <title>Re: Change VM ip address</title>
      <link>http://communities.vmware.com/message/1302601?tstart=0#1302601</link>
      <description>After much trial and error, I think I have found out how to do it without the need to clone the VM.  I don't know if this is useful, but you should be able to construct the same CustomizationSpec and apply it during a CloneVM operation instead of CustomizeVM.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="jive-pre"&gt;&lt;code class="jive-code jive-plain"&gt;#connect to VirtualCenter with credentials
Connect-VIServer -Server VC_SERVER -User USERNAME -Password PASSWORD

#VM Variables
$vmpool = &amp;quot;Testing Pool&amp;quot;
$vmname = &amp;quot;TestVM01
$vmtemplate = &amp;quot;winxpsp3&amp;quot;
$vmfolder = &amp;quot;DB-Provision&amp;quot;
$datastore = &amp;quot;LAB_ESX_Celerra&amp;quot;
$ip = &amp;quot;192.168.0.101&amp;quot;
$subnetmask = &amp;quot;255.255.255.0&amp;quot;
$gateway = &amp;quot;192.168.0.1&amp;quot;
$dns = &amp;quot;192.168.0.20&amp;quot;
$domain = &amp;quot;lab.local&amp;quot;

##
$vm = Get-VM $name
$cg = New-Object VMware.Vim.CustomizationGlobalIPSettings
$cg.DnsServerList = $dns
$cg.DnsSuffixList = $domain

$cfi = New-Object VMware.Vim.CustomizationFixedIp
$cfi.IpAddress = $ip

$cis = New-Object VMware.Vim.CustomizationIPSettings
$cis.DnsDomain = $domain
$cis.DnsServerList = $dns
$cis.Ip = $cfi
$cis.Gateway = $gateway
$cis.SubnetMask = $subnetmask

$cm = New-Object VMware.Vim.CustomizationAdapterMapping
$cm.Adapter = $cis

$customspec = New-Object Vmware.Vim.CustomizationSpec
$customspec.GlobalIPSettings = $cg

$cust_name = New-Object Vmware.Vim.CustomizationFixedName
$cust_name.Name = $vmname

#Windows
$cust_sysprep = New-Object Vmware.Vim.CustomizationSysPrep
$cust_sysprep.GuiUnattended = New-Object VMware.Vim.CustomizationGuiUnattended
$cust_sysprep.GuiUnattended.autoLogon = $true
$cust_sysprep.GuiUnattended.autoLogonCount = &amp;quot;1&amp;quot;

$cust_sysprep.GuiUnattended.Password = New-Object VMware.Vim.CustomizationPassword
$cust_sysprep.GuiUnattended.Password.plainText = &amp;quot;True&amp;quot;
$cust_sysprep.GuiUnattended.Password.value = &amp;quot;password&amp;quot;

$cust_sysprep.UserData = New-Object VMware.Vim.CustomizationUserData
$cust_sysprep.UserData.orgName = &amp;quot;Testing&amp;quot;
$cust_sysprep.UserData.fullName = &amp;quot;Testing&amp;quot;
$cust_sysprep.UserData.ProdID = &amp;quot;YOUR PRODUCT KEY HERE&amp;quot;


$cust_sysprep.UserData.ComputerName = New-Object VMware.Vim.CustomizationFixedName
$cust_sysprep.UserData.ComputerName.name = $vmname

$cust_sysprep.Identification = New-Object VMware.Vim.CustomizationIdentification
$cust_sysprep.Identification.JoinWorkgroup = &amp;quot;WORKGROUP&amp;quot;

#$cust_sysprep.Options = New-Object VMware.Vim.CustomizationWinOptions
#$cust_sysprep.Options.changeSID = 0

$customspec.Identity = $cust_sysprep
$customspec.NicSettingMap = $cm

$vmv = Get-View $vm
$vmv.CustomizeVM($customspec)

&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Message was edited by: DougBaer -- I failed to mention that CustomizeVM only works when the VM is PoweredOff!</description>
      <pubDate>Sat, 04 Jul 2009 21:38:05 GMT</pubDate>
      <author>DougBaer</author>
      <guid>http://communities.vmware.com/message/1302601?tstart=0#1302601</guid>
      <dc:date>2009-07-04T21:38:05Z</dc:date>
      <clearspace:dateToText>4 months, 3 weeks ago</clearspace:dateToText>
      <clearspace:replyCount>5</clearspace:replyCount>
    </item>
    <item>
      <title>Re: Change VM ip address</title>
      <link>http://communities.vmware.com/message/1302574?tstart=0#1302574</link>
      <description>It may be helpful to look here&lt;br /&gt;
&lt;br /&gt;
&lt;a class="jive-link-external" href="http://communities.vmware.com/message/1301800#1301800"&gt;http://communities.vmware.com/message/1301800#1301800&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
for an example of a script that populates the customization spec.</description>
      <pubDate>Sat, 04 Jul 2009 20:07:36 GMT</pubDate>
      <author>DougBaer</author>
      <guid>http://communities.vmware.com/message/1302574?tstart=0#1302574</guid>
      <dc:date>2009-07-04T20:07:36Z</dc:date>
      <clearspace:dateToText>4 months, 3 weeks ago</clearspace:dateToText>
      <clearspace:replyCount>6</clearspace:replyCount>
    </item>
    <item>
      <title>Re: Change VM ip address</title>
      <link>http://communities.vmware.com/message/1302546?tstart=0#1302546</link>
      <description>I believe your customization spec is incomplete. I think you need to populate the object a little more fully, but I am not 100% certain what you need to provide to ONLY change the IP address. Your error is being caused by not having the following.  From there, I am still following the trail of breadcrumbs left by subsequent error messages &lt;img class="jive-emoticon" border="0" src="http://communities.vmware.com/images/emoticons/happy.gif" alt=":)" /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="jive-pre"&gt;&lt;code class="jive-code jive-plain"&gt;$vmcloneSpec.Customization.Identity = New-Object VMware.Vim.CustomizationSysprep
&lt;/code&gt;&lt;/pre&gt;</description>
      <pubDate>Sat, 04 Jul 2009 18:41:41 GMT</pubDate>
      <author>DougBaer</author>
      <guid>http://communities.vmware.com/message/1302546?tstart=0#1302546</guid>
      <dc:date>2009-07-04T18:41:41Z</dc:date>
      <clearspace:dateToText>4 months, 3 weeks ago</clearspace:dateToText>
      <clearspace:replyCount>7</clearspace:replyCount>
    </item>
    <item>
      <title>Change VM ip address</title>
      <link>http://communities.vmware.com/message/1302532?tstart=0#1302532</link>
      <description>&lt;br /&gt;
I am trying to get the change vm ip address (from the PowerCLI faq &lt;a class="jive-link-external" href="http://communities.vmware.com/docs/DOC-4210"&gt;http://communities.vmware.com/docs/DOC-4210&lt;/a&gt;) to work but get an error. The error can be found in the attachment. &lt;br /&gt;
&lt;p /&gt;
This is the code:&lt;br /&gt;
&lt;br /&gt;
$vmclonespec = New-Object VMware.Vim.VirtualMachineCloneSpec&lt;br /&gt;
$vmclonespec.Customization = New-Object  VMware.Vim.CustomizationSpec&lt;br /&gt;
$vmclonespec.Customization.NicSettingMap = @(New-Object VMware.Vim.CustomizationAdapterMapping)&lt;br /&gt;
$vmclonespec.Customization.NicSettingMap[0].Adapter = New-Object VMware.Vim.CustomizationIPSettings&lt;br /&gt;
$vmclonespec.Customization.NicSettingMap[0].Adapter.ip = New-Object VMware.Vim.CustomizationFixedIp&lt;br /&gt;
$vmclonespec.Customization.NicSettingMap[0].Adapter.Ip.IpAddress = "192.168.123.123"&lt;br /&gt;
$vmclonespec.Customization.Identity = New-Object vmware.Vim.CustomizationIdentitySettings&lt;br /&gt;
$vmclonespec.Customization.GlobalIPSettings = New-Object VMware.Vim.CustomizationGlobalIPSettings&lt;br /&gt;
&lt;br /&gt;
$vmclonespec.config = New-Object VMware.Vim.VirtualMachineConfigSpec&lt;br /&gt;
$vmclonespec.location = New-Object VMware.Vim.VirtualMachineRelocateSpec&lt;br /&gt;
&lt;br /&gt;
$vmclonespec.powerOn = $false&lt;br /&gt;
$vmclonespec.template = $false&lt;br /&gt;
$name = "Test"&lt;br /&gt;
&lt;br /&gt;
$target = Get-Folder -Name "Lab" | % {Get-View $_.ID}  &lt;br /&gt;
$vmmor = Get-VM -Name "WXPLAB" | Get-View&lt;br /&gt;
$vmmor.CloneVM_Task($target.MoRef ,$name, $vmclonespec )&lt;br /&gt;
&lt;p /&gt;
&lt;p /&gt;</description>
      <pubDate>Sat, 04 Jul 2009 18:12:59 GMT</pubDate>
      <author>ICT-Freak</author>
      <guid>http://communities.vmware.com/message/1302532?tstart=0#1302532</guid>
      <dc:date>2009-07-04T18:12:59Z</dc:date>
      <clearspace:dateToText>4 months, 3 weeks ago</clearspace:dateToText>
      <clearspace:replyCount>8</clearspace:replyCount>
    </item>
  </channel>
</rss>

