Using CLI, I would clone a virtual machine between different data centers

Hello!!

We have two data centers.

We want to clone a virtual of DataCenter1 to DataCenter2 machine.

We cannot with vSphere.

Does anyone know how we can do this? any idea?

Thank you very much

Jose.

Cloning is a feature of vCenter Server, not a host ESX (i). You need to connect to vCenter, that's why you get the error because this operation is not supported in a host ESX (i)

=========================================================================

William Lam

VMware vExpert 2009,2010

VMware VCP3, 4

VMware VCAP4-DCA

VMware scripts and resources at: http://www.virtuallyghetto.com/

Twitter: @lamw

repository scripts vGhetto

Introduction to the vMA (tips/tricks)

Getting started with vSphere SDK for Perl

VMware Code Central - Scripts/code samples for developers and administrators

VMware developer community

If you find this information useful, please give points to "correct" or "useful".

Tags: VMware

Similar Questions

  • How is it possible to clone a virtual machine cluster when data warehouses not presented in source and destination

    I did not know that on ESX 3.5, in order to afin de vivre live clone a virtual machine from one ESX host to another, source and destination stores had to be available. However, I'm currently cloning a virtual machine to a host in a datacenter and cluster to one host in a different data center, but the destination store is not available at the source host and visa versa.

    How is that possible?  This is a new feature of vSphere?

    That seems to work on the console port. See this thread: http://communities.vmware.com/message/1475721#1475721

    AWo

    VCP 3 & 4

    Author @ vmwire.net

    \[:o]===\[o:]

    = You want to have this ad as a ringtone on your mobile phone? =

    = Send 'Assignment' to 911 for only $999999,99! =

  • Clone the virtual machine between two ESX 3.5.0 servers (low connection)

    Hi all!

    I have two ESX 3.5.0 servers that are managed by a vCenter servers one have just the connection of 32 KB.

    I need to clone one of my virtual machines from one to the other ESX is W2k8 created with 40 GB HARD drive. I tried to start it clone trough my low connection, but the task is about 86% for 4 days :|

    Is it possible to clone virtualmachine on one of my ESX for its local storage and after that, get it by vCenter for example an external HARD drive and then copy them all to my second ESX? How to run copied virtual machine on my second ESX? Maybe I can do it with another way - ideas?

    Two ESX are the same versions and machines, only the names and the ip addresses are different.

    Thanks for the tips

    Kris

    I don't think it is possible since the virtual disk will be 40 GB in size - I was suggesting using a laptop as a server NFS ESX sees and access the virtual machine for this storage clone - it take the first vessel of ESX host it to secondary site attach NFS datastore on the second ESX Server and using the browser of data store you navigate to the cloned VMX of VM file and to him the second ESX host - you can cold migrate leaving the second host and then move the cursor above for the storage you want.

    If you find this or any other answer useful please consider awarding points marking the answer correct or useful

  • How do divide you a virtual machine between two data stores?

    We just installed a new SAN ICSI and created an ISCSI target on it. We have created a new data store on our server ESXi 4.0 and reminded our Iscsi target. Our virtual machines have two logical drives, for the system partition C: and E: for data. At present, all virtual machines are residing on the 1 data store, which is located on the local hard drives of the esxi server. How pass readers E: of the virtual machine to the SAN and let C: readers where they are?

    Hello

    Or if you don't have a Vmotion, you can use stand-alone Vcenter converter to migrate your VM on the same ESXi host. and during this process on the Advanced tab, you can divide your virtual disks in the desired data store. You can keep the C: drive as it is on the same data store and add new vmdk and select its data store that you want, and then can move E: or D: drive until the new vmdk.

    In this way, you can split your C: and other disks on different vmware disks on different data warehouses.

    Let me know if it helps.

    Kind regards

    Sumit

  • VCo workflow to clone a virtual machine of centos. Network interface problem

    Hello

    I use vco workflows to clone a virtual machine of vcenter. The virtual machine is running centos 6.0. When cloning is complete. I see the network eth0 and eth1 interfaces set correctly the static gateway ip and address information I provided. I deleted the 70 - persistent - net .rules on the basic vm form which I clone. So, I get the correct interface names. But when vm powers on and I run "ifconfig eth0" I don't see the IP address of this interface has all the details.  same for the other interface also.

    But if I do a system restart network without changes to networking and then do an ifconfig I see the IP with the previous information.   I don't know why the service network restart is necessary so that he can recognize the ip address.

    Any ideas what I could do wrong. or to avoid this manual step of the execution of the service network restart command on the creation of the vm.

    Thank you

    Kiran

    Yes I'm restarting after after the application of customization.

    Has been able to solve the problem... In CentOS, the network service does not work by default. This is why it does not have network interfaces at startup. So now the machine instant, I started the network services and stop the Network Manager service

    using chkconfig network on

    chkconfig NetworkManager off

    and then cloned from this virtual machine... and apply the customization settings. during the start now it shows the interfaces properly without needing a service restart

  • Replicate a virtual machine between an Intel host computer and an AMD

    Does anyone has experiences with using vSphere replication to replicate a virtual machine between Intel server cluster and a cluster of servers AMD?

    I asked myself this question the other day and unfortunately I have Intel hosts in my lab to test/demo so can not perform checks...

    I know that the only safe way to migrate a virtual machine from one host to Intel to a host of AMD is to use migration cold (ie the power off of the virtual computer), but that also applies if you use replication as a tool of "migration."

    I am aware vSphere replication can occur only if the source THAT VM is turned on, as it will make a copy of the initial/seed and then use CBT for replication of the changes... but because the goal of VM is turned off, I am correct in assuming that it is a form of "cold migration"?

    It works with the solution of Veem replication with VMware hosts.

    Reference:replication requirements. See the topic

    It seems to even work with Hyper V - replica.

    Hyper-V R2 2012 replica from INTEL to AMD? -Spiceworks

    In my view, this works for vSphere same replication as well. However, I will stay here with confirmation.

    --------------------------------------------------------------

    If it is useful, please give points as correct or useful

  • How to clone a virtual machine using ESXi 4.1 and vSphere?

    Instructions for I have seen that you can click with the right button on a virtual machine and choose "Clone", but I think it's only for vCenter

    Is there a way to clone a virtual machine in vSphere?

    Thank you

    If you have a licensed copy of ESXi (not vSphere Hypervisor, the free version), you can try the document below.  However, if you do not have a licensed copy you vCenter for cloning function

    http://communities.VMware.com/docs/doc-11708

  • How to clone a virtual machine with the drive?

    Hello

    Previously, I used VMware Workstation and has a mastery of "clone". Now I use the reader and I would like to clone my current VM and there is no special orders. Simply copy the directory would probably not there a lot of information such as DNS name, etc. that are likely to be changed. Is it possible to clone a virtual machine with player or do I Workstation?

    Many thanks in advance,

    Nicolas

    In my computer a full clone is nothing more then is not a copy that was made unique in the process and the players of VMware capacity but there is nothing stopping you from manually making a copy and then manually by making the changes to make it unique.

  • Get use of the resources of all virtual machines in a cluster

    Hello

    I have developed a measure of capacity management report that collects all the use of the resources of the virtual machines in a datacenter. The function that collects it looks like this:

    def hostMemoryConsumed =]

    def memoryConsumed = 0.0f

    def memoryGranted = 0.0f

    VMs. each() {}

    VM->

    try {}

    memoryConsumed += vm.host.memory.consumed.current.average / 1024.0f<----- how="" to="" do="" this="" to="" get="" from="">

    memoryGranted += vm.host.memory.capacity.current.average / 1024.0f

    }

    {} catch (NullPointerException e)

    }

    VMS is a function of type parameter VMS VMW

    The works above for virtual machines in the data center, but I need it to be after cluster. I can find a cluster of virtual machines, but I'm having trouble with referring to specific values for example consumed memory and capacity.

    If I change the type parameter: VMW Cluster how the metric reference would look like (see the try {})?

    I don't think that a query will help me.

    Thanks in advance

    Erik Alm

    If you want to do for a cluster, you can just get the list of virtual machines in a cluster of first and passing in your script.  If you have a function for a VMWCluster you can add a parameter for "vmwCluster" that is underneath and it should give you a table (topologyObjects) that has all the virtual machines in the cluster.

    QS = server.get ("QueryService") / / query Service

    tquery = qs.createStatement("!) (' VMWVirtualMachine where esxServer.parent.name = "+" ' "+ vmwCluster +" "" ") .setQueryTopologyObjects (true);

    topologyObjects = qs.executeStatement (tquery) .getTopologyObjects)

  • Clone a virtual machine to a Cluster data store

    Hello

    Really simple (hopefully), but I'm trying to write a workflow that includes the provision of a virtual computer to a cluster of data store. I'm a link to the workflow 'Clone the virtual machine, no customizations' that only accepts a store of input data.

    I hope that I am a bit stupid here and there is a simple answer?

    Thank you.

    There is no simple answer.  DRS clusters are actually a set of rules and not a real thing, you can deploy a VMDK.  I suggest to use Onyx to deploy a virtual computer to a DRS cluster and see what it generates.  If I remember correctly, it executes DRS rules to get a recommendation for where to put a VMDK fundamentally and then uses the exit in order to actually deploy the model.

    I opted to write just a simple workflow that finds the data store with the most of freespace that corresponds to a string - for example, if I have a DRS cluster named DSCluster_ugabuga, I have a lot of data stores named something like "ugabuga... ».  So you ask these storages of data and find the one which most freespace.

  • Clone a virtual machine directly from single ESXi host

    Hi, I want to clone a virtual machine with all the related feathers which the Associate ID (CPU ID, UUID, BIOS ID, etc.) and redeployed on another single ESXi host. It could help me how can I do?

    Hello

    without vCenter server you can accomplish this by check script PowerCLI this useful post below:

    Tools of HL - part 1 - clone a virtual machine without vCenter - notes LucD

    If you want to clone individual disks check this KB:

    VMware KB: Cloning of disks to the individual virtual machine through the ESX/ESXi terminal host

    _________________________________________________________________________________________

    If you have found this device or any other answer useful, please consider to award points. (use the useful or correct)

    Kind regards

    P.

  • Error trying to clone a virtual machine

    Hello

    I'm trying to use the vsphere api 5.0 to clone a virtual machine that was created in the web client.

    Here is my XML SOAP message:

    <? XML version = "1.0" encoding = "UTF-8"? >

    " < SOAP-SOAP ENV:Envelope - ENV:encodingStyle = ' http://schemas.xmlsoap.org/SOAP/encoding/ "xmlns:SOAP - ENV =" " http://schemas.xmlsoap.org/SOAP/envelope/ "container =" " http://www.w3.org/2001/XMLSchema "" xmlns: xsi = " " http://www.w3.org/2001/XMLSchema-instance "xmlns:SOAP - ENC =" " http://schemas.xmlsoap.org/SOAP/encoding/ ">

    < SOAP - ENV:Body >

    < CloneVM_Task xmlns = "urn: vim25" >

    < _this type = 'VirtualMachine' > vm-xxxxx < / _this >

    < folder > datacenter-xxxxx < / case >

    < name > clone-test-1 < / name >

    < spec >

    < location >

    store of data <>data store - xxxxx < / datastore >

    resgroup-xxxxx < pool > < / pool >

    < / location >

    false < template > < / template >

    false < powerOn > < / powerOn >

    < / spec >

    < / CloneVM_Task >

    < / SOAP - ENV:Body >

    < / SOAP - ENV:Envelope >

    but I get the error "the application refers to an unexpected or unknown type".

    Here is the entire response in a table:

    {Array (15)}

    'key' = >

    String(11) "task-xxxxxxx".

    "task" = >

    String(11) "task-xxxxxxx".

    'name' = >

    (12) a string "CloneVM_Task".

    'descriptionId' = >

    (20) a string "VirtualMachine.clone".

    'entity' = >

    String (8) "vm-xxxxx".

    "entityName" = >

    (8) a string 'xxxxxx '.

    'State' = >

    String(5) "error".

    'cancelled' = >

    String(5) "false."

    'Cancel' = >

    (4) a string 'true '.

    'error' = >

    {Array (2)}

    'fault' = >

    {Array (1)}

    "argument" = >

    (22) a string "ManagedObjectReference".

    }

    'localizedMessage' = >

    String (52) "request refers to an unexpected or unknown type."

    }

    'reason' = >

    {Array (1)}

    'userName' = >

    String (10) "myusername".

    }

    'queueTime' = >

    (26) string "xxxx".

    "startTime" = >

    (27) string "xxxx".

    'completeTime' = >

    (26) string "xxxx".

    'eventChainId' = >

    String (7) 'xxxxxxx '.

    }

    Thanks in advance for any help, it will be greatly appreciated!

    Yes, login and vcenter.

    Thanks for trying to help, but I managed to solve it.  It turns out that it was

    1. I was providing the setting wrong folder (should have been the result of FindByInventoryPath('your_data_center_name/vm') instead of FindByInventoryPath ('your_data_center_name')

    2. I didn't need to provide anything inside the 'location' parameter, it comes to be present

    Thank you again and hope that the above comments help someone else trying to do the same thing

  • Clone a virtual machine and change is the network settings?

    I'm looking to clone a virtual machine several times change the network connection and the IP he uses, any help appreciated.

    NP, alternative, will host this script:

    $vmlist=Import-CSVC:vms.csv
    foreach($itemin$vmlist) {
     # I like to map out my variables
     $vmname=$item.vmname
     $ipaddr=$item.ipaddress
     $subnet=$item.subnet
     $gateway=$item.gateway
     $pdnswins=$item.pdnswins
     $sdnswins=$item.sdnswins
     #Get the current interface info
     $GuestInterface= Get-VMGuestNetworkInterface -VM $vmname -HostCredential $HostCred-GuestCredential$GuestCred
     #If the IP in the VM matches, then I don't need to update
     If ($ipaddr-ne$($GuestInterface.ip)) {
         Set-VMGuestNetworkInterface-VMGuestNetworkInterface$GuestInterface -HostCredential $HostCred -GuestCredential $GuestCred -IP $ipaddr -Netmask $subnet -Gateway $gateway -DNS $pdnswins,$sdnswins-WINS  $pdnswins,$sdnswins
     }
    }
  • Can I use the same windows on my virtual machine?

    I had windows pre-installed in my dell laptop (Latitude E6420). I did not have the cd key but I extracted using a program called Magical jelly bean key finder. Now, I have the following information on my windows installation

    Windows 7 Professional Service Pack 1
    Product no.: XXXXXXXX
    Installed from media "OEM."
    Product ID: XXXXX-OEM-XXXXXXXX
    CD Key: XXXXXXXXXXXXXXXXXXXXXXXX
    Computer name: XXXXX
    Registered owner: XXXXX
    Registered organization: Microsoft
    Now, I want to install linux on my machine and use the current windows in a virtual machine inside the linux host. Is is possible if I completely uninstall this windows of my computer and reinstall the virtual machine with the same key?
    I'm not very familiar with this also can someone guide me what are the steps I have to take if this is possible.

    Hi Andre,

    Thank you for your answer, but this does not completely answer my question. I also read that OEM installation does not install the same windows on another machine (virtual machine is like different machine even if I do this on the same machine) and installation of the mine is OEM type.

    More important still, how install windows in the virtual environment? If I format the computer and install linux, in addition to this install virualbox and install inside windows that use the cd - key and it will work. ? I doubt it because the windows is already activated in this machine.

    The extract of the contract (EULA) for Windows 7 and applies to the retail and OEM of Windows 7 versions. So, Yes, you can reinstall it in a Virtual Machine.

    Yes, you will need to format the machine under Linux, then reinstall Windows 7 in a computer program virtual suitable as Oracle Virtual Box 4.2, VMWare Player 5.0 or VMWare Workstation. You can then use the product key located on the COA sticker to reactivate the license.

  • Clone the virtual machine to the local data store

    Hi all

    I'm looking to automate a task daily (or almost) of my friends with a small script with powercli.

    I'm trying to "backup" or to clone a virtual machine, I work in a storage of one of our servers.

    The servers are managed by a 5.1 vCenter and the machine is on a shared storage.

    From time to time, I clean, stop the machine, remove all snapshots and clone the virtual machine to one of the local server as a backup storage. So I put together a small script which almost works. It works as long as the target data store is a shared storage, but not with a local storage.

    I get always an error that claims it can not access the local data store and is not a permissions problem...

    Given that I can accomplish this via the customer without problem I thought it is possible via powercli too, or I'm wrong?

    My Script up to now:

    # Variables
    $VC = "vc.domain.com" #vCenter Server
    $User = "domain\user" #User
    $Pass = 'test123' #User PW
    $VMName = 'scripttest' #VM
    $BackupSuffix = "backup" #Suffix to add the name of VM to mark this as a backup
    $VmHost = "esx2.domain.com".
    $Datastore = 'ESX2-LocalData' #Datastore
    $BackupFolder = 'Backup' #Folder the VM gets classified


    # Register cmdlets to VMware

    If (-not (Get-PSSnapin VMware.VimAutomation.Core - ErrorAction SilentlyContinue)) {}

    Add-PSSnapin VMware.VimAutomation.Core

    }


    # Connect to the server

    SE connect-ViServer $VC - user $User-password $Pass


    # Remove the old clone

    $OldBackups = get - VM | WHERE {$_.} {Name: corresponds to '$VMName - $BackupSuffix'}

    If ($OldBackups - don't "")

    {

    If ($OldBackups.Count - gt 1)

    {

    Write-Host "better check! "Found several results:

    Foreach ($VM to $OldBackups)

    {

    Write-Host $VM. Name

    }

    }

    on the other

    {

    Remove-VM - VM $OldBackups - DeleteFromDisk-confirm: $false

    }

    }


    # Clone VM

    $VMInfo = get - VM $VMName | Get-View

    $CloneSpec = new-Object Vmware.Vim.VirtualMachineCloneSpec

    $CloneSpec.Snapshot = $VMInfo.Snapshot.CurrentSnaphshot

    $CloneSpec.Location = new-Object Vmware.Vim.VirtualMachineRelocateSpec

    $CloneSpec.Location.Datastore = (get-Datastore-name $Datastore |) Get - View). MoRef

    $CloneSpec.Location.Transform = [Vmware.Vim.VirtualMachineRelocateTransformation]: sparse

    $CloneFolder = $VMInfo.Parent

    $CloneName = "$VMName - $BackupSuffix".

    $TaskCloneID = $VMInfo.CloneVM_Task ($CloneFolder, $CloneName, $CloneSpec)


    # Check if the task is completed


    $Check = $false

    While ($Check - eq $false)

    {

    $Tasks = get-job | Select State, id | Where {$_.} State - eq "Running" - and $_. State - eq "pending"}

    ForEach ($Task in $Tasks)

    {

    If ($Task.id - eq $TaskCloneID)

    {$Check = $false}

    on the other

    {$Check = $true}

    }

    Start-Sleep 10

    }

    # Move clone to the backup folder

    Move-VM - VM '$VMName - $BackupSuffix' - Destination $BackupFolder


    # Disconnect

    Disconnect-VIServer-confirm: $false

    Can you show us the complete error message you get?

    BTW, the clone step can be replaced by the New-VM cmdlet with the setting of the virtual machine.

Maybe you are looking for

  • My send icon is missing. How can I can not get it back.

    I'm helping a friend with his computer. After she wrote and email or responses, there is no way to touch an icon send. It seems that the toolbar is missing and I was not able to understand how to get to the back.

  • Use of the battery is displayed

    For some reason any my battery usage ceased to show. Under the battery is said only: "battery information will be available after using the phone for a few minutes. I used the phone and still nothing. I tried reboot etc and still does not.

  • Link Tempo for the DVD player does not work

    Tempo of Toshiba informed me that a new DVD drive driver is available dvdpl - 20070807102909.zip, but the link does not work in Internet Explorer. The link is http / / www.download1.stage.toshiba.eu but I get a message that Internet Explorer cannot f

  • Good battery charge for laptop to HP 15-D014tu Intel i3 - 3110M

    Hi, I know that this subject has been discussed and there is a lot of information online about this but he simply left me confused.  My question is what is the correct way to the battery of my new book of charge/discharge.  I have load to 100% and th

  • Question about Windows backup utility

    My Satellite came with Windows XP Home Edition.MS inform that this happened with a Windows backup on his drive, BUT I don't him is not (of course, Toshiba has not provided a disk full XP, only their recovery and tools disks etc...).Could someone plea