HOWTO delete a VMDK to a virtual machine without actually deleting the vmdk disk file?

How to remove a file VMDK to a virtual machine without actually deleting the vmdk disk file?

Details:

My perl script, I need to temporarily remove a vmdk to a virtual machine file. However I do not want the vmdk file should be removed from the virtual machine. For example, the gui vsphere provides this option to delete a virtual disk without deleting the virtual disk from the disk files.

In my script, I use the ReconfigVM_Task to do this. This does the job, but also removes the vmdk file. How can ensure me that the vmdk file will not delete the disk?

The code snippet is something are:

My $devspec = VirtualDeviceConfigSpec-> new)

device = > $device,

#device to delete above:

operation = > VirtualDeviceConfigSpecOperation-> new ('remove'));

Push (@$ devspec_list, $devspec);

My $config_spec = VirtualMachineConfigSpec-> new)

deviceChange = > $devspec_list

);

my $task = $template_view-> ReconfigVM_Task (spec = > $config_spec);

would really appreciate your help

s

Take a look at this script: vmdkManagement.pl

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

William Lam

VMware vExpert 2009

Scripts for VMware ESX/ESXi and resources at: http://engineering.ucsb.edu/~duonglt/vmware/

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

  • virtual machine cannot start, because the snapshot of the virtual machine has been deleted by mistake.

    virtual machine cannot start, because the snapshot of the virtual machine has been deleted by mistake.

    When I start this virtual machine, it prompts: unable to find the 0001.vmdk, this disc is my shot, has been deleted by mistake.

    How to restore this virtual machine.

    You need help with a revival of the 000001.vmdk deleted or do you want to repair the virtual machine so that it works without the snapshot?

    The last option, follow these steps:
    remove the virtual machine from the inventory and edit the vmx file so that it uses the basedisk. Then add the virtual machine to inventory.
    If you need data from the snapshot call me through Skype "sanbarrow" - I may be able to help

  • How to start a virtual machine without vmx file

    Hello, I have a virtual machine that I want to start up using 10.0.0 on Ubuntu 14.04 32-bit workstation but I don't have multiple vmdk files and a file on me vmxf and apparently, that's all that is in the software. How do I run something like that?

    Hello
    You cannot start a virtual machine without a vmx file.
    If you do not have a vmx file - fly a.
    For example this one:
    -----------------------------------

    . Encoding = "windows-1252".

    config.version = '8 '.

    virtualHW.version = '8 '.

    scsi0. Present = 'TRUE '.

    scsi0.virtualDev = "free".

    memsize = "2048".

    scsi0:0. Present = 'false '.

    scsi0:0. FileName = "set-path-to-bootdisk-and-then-set-.present-to-true-to-activate".

    ethernet0. Present = 'TRUE '.

    ethernet0.virtualDev = "e1000".

    displayName = "minimal-vm.

    guestOS = "windows7-64.

    virtualHW.productCompatibility = "hosted".

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

    That cuts into a file and store it as a *.vmx.
    Then launch the new VM with
    VMware /path-to-vmx/name.vmx or
    vmplayer /path-to-vmx/name.vmx
    Other users may also recommend to simply launch the user interface and follow the file > New menu...
    and then order the new virtual machine to the card by selecting your existing virtual disks.

  • API to create a Virtual Machine without using a model

    I see the GUI documentation how to create a virtual machine without a model, but I can't find the actions of the API how to build the virtual machine based on custom settings (CPU, memory, OS, etc.), there are a only of the shares how instantiate OVF or vAppTemplate. Could you please tell is possible to generate/create the VM without model or OVF by API?

    I see. Thanks for the background.

    Based on my notes there is no such API. Other applications were similar to this one and the solution suggested in this case is to programmatically create an OVF (describing the configuration of the VM to instantiate) and import it into the vDC. The end result is the same (i.e. an empty VM configured by entries) the difference is how it gets instantiate (created from zero Vs described in the OVF and imported).

  • Storage DRS, move a virtual machine that is in the data store is not a member of DTS

    Dear all,

    If I've set up storage DRS that contains, for example, DS1 and DS2. I have another virtual machine that resides on DS that is not part of the cluster of DTS. Can I move this virtual machine to one of the (DS1, DS2) data store? OR will some disruptions?

    Thank you

    Jocelyn,

    Which is correct in both cases. You can leave DTS place it for you (which is my suggestion), but I thought you wanted it to go to a specific data store.  That being said you can reactivate the DTS for a virtual machine under the SDR change settings if you do not ever clear for a virtual machine

  • Created in Esxi virtual MACHINE can't see the network

    Hello

    I installed Esxi 5.5 and I have no problem to access and create a virtual machine.

    However, the virtual machine, which is 2012 Windows, does not begin with a network adapter.

    When I check the configuration of the VM, the network adapter is connected, turned on, E1000E but says directpath e/s is not supported. I don't have VMware tools installed in the virtual machine.

    I don't understand where the problem lies. I connect to Esxi ok. I can run the virtual machine in Esxi client ok, but the images says that there is no network.

    I created the VM Windows before 2012, outside of Esxi and the network built in card is detected ok.

    STOP PRESS - in computer management Windows, peripheral, the Ethernet controller is not recognized. So, how can I get the virtual machine to recognize when it is running in ESXI?

    Help?

    Thank you

    Jason

    Also can you check with adapter VMXNET or tru uninstalling and reinstalling VMware tools.

    -f10

    http://highoncloud.blogspot.in

    Virtualization VMware on NetApp

  • ESXi 5.5 - Virtual Machine fails to PING the gateway and/or other hosts

    Hello ladies and gentlemen

    I have installed HP DL380p Gen8 1 with vmware ESXi 5.5.

    I have 1 with 2 vmnic Virtual Machine port group - vmnic0 and vmnic1 connect 2 virtual machines. If I have the TEAM network cards, a VM (selected) randomly is able to PING to the gateway while the 2nd VM is not. ESXTOP in this case, don't watch not the physical NETWORK card that each virtual computer connects to but says 'all' to the title of the team-TEDDY.

    If I break the team and you use only vmnic0 - none of the VMs connet to the gateway. If I create the vSwitch with only vmnic1 as usable NIC (vminc0 - unused) - once again only 1 VM (randomly chosen) is able to PING the gateway while the other is not (and two VMS use vmnic1 as the uplink to the vNIC).

    The physical ESX host connects to a Catalyst Cisco 2950 switch.

    Can you please advise where can I go from here? It could be a problem with the VLAN when it comes to vmnic0 (since none of the virtual computers are able to connect through this vmnic), but what is happening with vmnic1 (a virtual machine connects randomly while the other doesnot)...?

    I tried several forums without success.

    Managed to solve this one-

    1. The uplink switch (Catalyst 2950) was Port security enabled on all THE Ports.
    2. I had to disable the port on a given set of ports security (to which are connected the physical network adapters).

    Everything seems to work fine now.

    Bravo to all the entries!

  • 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
     }
    }
  • How to recover a virtual machine without vCenter

    Hello

    My setup is that, currently, I have 5 physical host (esxi 4.1) and I'll take backup using vmware datarecovery. my environment works fine. I deploy vcenter as a virtual machine, and also take the backup via VDR applicance. now, I'm a bit confused, if my vm vcenter's crash how to retrieve, as VDR is integrated with vcenter. any solution in this regard?

    Kind regards

    Muhammed Mohsin Khan

    If VC crashes

    Install the VDR plugin on the system you are goping VI client make for guests

    Once the plugin is installed to conenct to the host directly where the VDR unit is in place and functioning, rest are the steps that you normally VC.

    Concerning

  • Virtual machine does not start the Server Windows 2003 Std ISO file?

    Hello

    I am trying to create a virtual Windows 2003 machine, I created the ISO file, downloaded on my ISO library and connected the CDROM drive for the ISO file.

    When I boot the maching, I select the start menu and select the CDROM drive the virtual machine starts the ISO?

    The continuous boot just on the network card boot.

    It's as if the virtual machine does not see the CDROM drive?

    I use folder2iso

    To me, it sounds as if the ISO created may not be bootable! How did you create the ISO file?

    André

  • virtual machines without port group

    You can manage the virtual machine without having to configure the virtual machine port group?

    The virtual machine port group, it's how the virtual machine connects to a network then Yes, that it is necessary if you want to have your VM to communicate on your network computers tother / with who in minde not you won't be able to manage the virtual machine through the VLAN withour groups of ports VM

  • Getting error: could not open the Virtual Machine: failed to query the Source for more information

    When I have a virtual machine to export to the FVO on an ESXi 4.0 and then try again to import the FVO on VMware Player or Workstation 7.1, I get the following message:

    «Could not open the Virtual Machine: failed to query the Source for more information.» I can successfully re-import this file OVF in an ESXi server without any problems. Anyone know why this is happening and what can be done to remedy this?

    Thank you

    Christopher

    Hello.

    Try to use ovftool to convert a VMX of the FVO.

    Good luck!

  • I'm not sure how to make it work. 2 guests, 2 virtual machines, trying to keep the traffic on the Server Blade.

    I have two blades on the same chassis running ESXi 4.1, each has an Exchange Server on it. Im trying to keep the traffic between the two Exchange boxes contained between the two. I thought that I could put in the same vSwtich, but looks like I need vDS for this. I don't have this license level.

    Now, I found myself with two separate vSwitches with the same label. network, it shows them on the same vSwitch so they don't transmit traffic. because they are separate switches... my vSphere networking missing a bit... need to study more.

    Since you have virtual machines on different blades that the traffic between the two will have to cross a physical network card.   If you need to segment this traffic, you can configure a VLAN in your network, add a new group of port on each host to ESXi virtual machine and then set up a NIC in the virtual machines to use this group of VIRTUAL LAN port.

    Though the virtual machines on the same host (always) you can configure a single vSwitch.   In this case the traffic between virtual machines would not hit the physical network and you wouldn't need even a physical NETWORK adapter, attached to the vSwitch.

    Dave
    VMware communities user moderator

    ESXi Essentials free training / eBook offer

    Now available - VMware ESXi: planning, implementation, and security

    Also available - vSphere Quick Start Guide

  • Can I change the RAM available on a virtual machine without having to reboot?

    I would like to know if there is an option to change the RAM available on a virtual machine without restarting the virtual machine. I saw this old news item that says that it is

    possible (http://news.cnet.com/8301-1001_3-10044031-92.html), but I don't know how to do it. Any suggestions?

    Thanks in advance.

    Arne post, called PowerCLI: toggle the function add Hot VMs, shows how.

  • can't resize HDD on any virtual machine XP, but on the other dare resize fine

    Of size of drive running in something weird today where we noticed that via vCenter if we try to resize the hard disk of a computer virtual with XP as the guest operating system, is greyed out. With any other OS (vista, server 2003, win 2000 pro, win 7, Server 2008), we can resize the hard drive very well.

    This applies even with brand new virtual computer, which do not even have an operating system installed. Just the Act of creating a virtual machine and to say the things that XP will be installed just grey on the resizing option. (This excludes other common mistakes - of course we do not have a snapshot on the VM brand new, and it is not running.)

    Any idea what could happen? This is not normal behavior, is it?

    Use the custom option instead of typical when you deploy XP guest.  In this way, you can choose which controller to use.  And to increase the space on the IDE XP guest, use VMware Converter.  And while you're there, step 3 change the controller type to SCSI LSI

Maybe you are looking for

  • about connection

    Just got my new iMac set up and see that it forces me to sign in or use iCloud pw to connect.  I tried to disable by Sys Pref > users and groups and the automatic logon is greyed out.  How can I remove this? It is annoying because my iCloud pw is so

  • Strange Finder search Action

    -J' made a small text file (rtf) called view zip files.rtf If I search with spotlight for display, display zip, view files zip, reviews, Spotlight etc. detects the files correctly. If I search with Finder, view zip files.rtf, or any partial name it w

  • Screen dark on Portege M400 during execution of a stack

    Hallo,does anyone know how to get the color of light display after plugging on the m400 power?The "Fn"-key (F6/F7) don't work! ". I hope that there not yet special-race-necessary for this simple task background process? Thank you.

  • Reset of oversized IPR (488%) in Windows XP

    The DPI setting in my laptop (Windows XP) HP has been set by mistake to 488% - this translates grosslyover size pages - I tried to access the property page view to restore the DPI setting, but because of the excessive size I can't move around the pag

  • Updated KB2633870 and KB2600217 do not settle

    High priority update KB2633870 and KB2600217 software update optionally fail during installation without error code - just failed "not installed".