VMware {code} Community
alexnbg72
Contributor
Contributor

Backup VMs

hallo!

i have a problem automatically backing up my vms running on esxi 4.0.0 208167.

i purchased vsphere essentials to get full access to the api. installed the newest vsphere powercli on a windows 7 ultimate machine, downloaded a backup sript which creates a snapshot and then uses clonevm to create the clone, etc.

when i run the script i get the following message:

Ausnahme beim Aufrufen von "CloneVM" mit 3 Argument(en): "The operation is not supported on the object."

the next thing i tried is to user the clonevm_task function. this lead to the same result.

then i installed the vcenter server on a windows server 2008 r2 machine and tried it again. and i got the same error.

now i'm frustrated. can someone help me out of this mess???

regards

alex

0 Kudos
9 Replies
a_p_
Leadership
Leadership

Make sure you run the command on the vCenter Server and NOT the ESX host.

Take a look at CloneVM_Task throws MethodNotFoundFault for more details.

André

0 Kudos
alexnbg72
Contributor
Contributor

hi andré!

i've read this thread but i don't know what you mean by running this command on the vcenter-server and not the esx host.

do you mean that i have to connect to the vcenter server and not the esx machine when using the connet-viserver command?

regards

alex

0 Kudos
a_p_
Leadership
Leadership

Alex,

do you mean that i have to connect to the vcenter server and not the esx machine when using the connect-viserver command?

Yes, some functions require to run on the vCenter server.

You can verify that by connecting to the ESX host and/or the vCenter Server using the vSphere client. Only when connected to the vCenter Server you will be given options like cloning.

Probier's einfach mal Smiley Wink

André

0 Kudos
alexnbg72
Contributor
Contributor

hi!

genau das wars. nachdem ich herausgefunden hab, dass ich den esx-host in den server einbinden musste, musste ich mich einfach mit dem server verbinden. dann hats geklappt! das leben kann so einfach sein! Smiley Wink

hätte da noch eine newbie frage: ich mache das backup jetzt mit admin-rechten. ist ein wenig blöd. wie muss die rolle aussehen, damit ich das backup druchführen, aber nichts am host rumpfuschen darf?

gruß

alex

0 Kudos
a_p_
Leadership
Leadership

Alex,

then permissions you need mainly depend on what your script is doing, so I can't help you very much with this. Sorry.

André

PS: Even though we are both Germans, please write your posts in English, so others having similar issues can benefit from the community.

Once your question is answered, please mark it as answered and select correct and/or helpful posts.

0 Kudos
alexnbg72
Contributor
Contributor

hi!

ok - understood.

i run that script on an "powered on" vm. it thew many errors i.e.:

New-Snapshot : 27.06.2010 12:48:34 New-Snapshot BA2E8548-A999-4449-8184-8

209E18BE921 The operation for the entity vm-72 failed with the following mes

sage: "Error encountered while restarting virtual machine after taking snapshot

. The virtual machine will be powered off.

"

Bei C:\powerscripts\VMBackup.ps1:30 Zeichen:33

+ $cloneSnap = $vm | New-Snapshot <<<< -Name "Clone Snapshot"

Ausnahme beim Aufrufen von "CloneVM" mit 3 Argument(en): "Der Vorgang ist im a

ktuellen Status nicht zulässig."

Bei C:\powerscripts\VMBackup.ps1:50 Zeichen:17

+ $vmView.CloneVM( <<<< $cloneFolder, $cloneName, $cloneSpec )

Get-VM : 27.06.2010 12:48:37 Get-VM VM with name 'LisA - Office 2003

- Entwicklung-20100627' not found, using the specified filter(s).

Bei C:\powerscripts\VMBackup.ps1:53 Zeichen:8

+ Get-VM <<<< $cloneName

Get-Snapshot : Das Argument darf nicht NULL oder leer sein.

Bei C:\powerscripts\VMBackup.ps1:56 Zeichen:58

+ Get-Snapshot -VM (Get-VM -Name $customer.MasterVM) -Name <<<< $cloneSnap

| Remove-Snapshot -confirm:$False

when i now try to start the original vm it says: cannot open the disk ' /vmfs/volumes......vmdk' or one of the snapshot disks it depends on. reason: broken pipe.

why????

regards

alex

0 Kudos
a_p_
Leadership
Leadership

Alex,

I have to admit that I am not very familiar with PowerCLI scripting (yet), however there are many community user who are.

I'd suggest you attach the script to your next post and describe your environment and the VM you want ot clone.

Did the VM in question already have snapshots when you ran the script?

You may also take a look at the vmware.log file(s) in the VM's folder (and/or attach these) to find out what happens when you try to start the VM.

André

0 Kudos
alexnbg72
Contributor
Contributor

i've managed to bring the vm to live again (which now was my main problem).

i've downloaded the vdmk file from the datastore to a local disk, removed the hdd from the vm, uploaded the file again to the datastore and reattached the hdd.

it's sure not the cleanest way, but it worked. Smiley Wink

now i try to dig deeper into powercli...

thx

alex

0 Kudos
stanguturi
VMware Employee
VMware Employee

I don't know if the issue is related to VIX API. You can post the question in PowerCLI community.

-Thanks

Sankar.

0 Kudos