How to remove all the drives except 0:0 "Computer1" and re - joining "computer2" all disks

Hello

I need to find a way with PowerCLI can I analyze virtual named "machine1" across all the disks on a computer off, and detach all disks except the system disk (0:0).  Next, I would like to re - join these discs "computer2".  Seems to be there should be a way to do this using the Remove Disk command, but I don't know how I would keep track of all the disks as Computer1 can have a different number of disks attached whenever I run this script.  Can anyone help?

CK

Try something like that.

$vmName1 = "vm1.

$vmName2 = "vm2.

$vm1 = get-VM-name $vmName1

$vm2 = get-VM-name $vmName2

$hd = get-disk hard - VM $vm1

$cntrl = get-controller SCSI - VM $vm1

$cntrl0 = $cntrl | where {$_.} {ExtensionData.BusNumber - eq 0}

$hd | %{

If ($_.) ExtensionData.ControllerKey - only $cntrl0. ExtensionData.Key - or

$_. ExtensionData.UnitNumber - no 0) {}

$vmdkFile = $_. File name

Remove-hard drive - HDD $_ - confirm: $false

New-disk-hard - VM $vm2 DiskPath - $vmdkFile - confirm: $false

}

}

Note that the script does not take into account the original SCSI controller, it added the VMDK to the first SCSI controller

Tags: VMware

Similar Questions

  • I sell desktop computer and need to know how to remove all of the pc?

    I sell desktop computer and need to know how to remove all of the pc?

    The most difficult part of the first paragraph is to create the boot floppies - which can be complicated and requires installation of Windows disks.

    Perhaps a third simple but effective alternative is simply to re - install Windows on your computer from the disc that came with your computer or from the recovery partition.  Resettlement will delete all files on the disc and replace them with the New Installation of Windows.  At this point, the fragments of your old files may remain on your hard drive.  So once relocation complete, download and install the freeware 'Eraser' software, run it and you want to specify the "free space" erased on your hard drive.  This will overwrite firmly all the data remains that has not already been overwritten by the Windows Installation.

    Eraser: http://eraser.heidi.ie/download.php>

    HTH,
    JW

  • How to remove all information from the computer so I can sell it?

    How to remove all information from the computer so I can sell it?

    Hello

    You will want to format the hard disk:

    1. you can use DBAN - http://www.dban.org/

    or

    2. you can follow this tutorial to clean install up to the step where you format the disk, in which you would then STOP (because you just want to get rid of the files on the hard drive, do not install Windows) - http://www.sevenforums.com/tutorials/1649-clean-install-windows-7-a.html

    Kind regards

    Patrick

  • How to restore pictures that have been deleted from Lightroom, but not removed from the 'drive '?

    How to restore pictures that have been deleted from Lightroom, but not removed from the 'drive '? Also, how can I restore photos after saving Lightroom. I started to remove some files and it removed ALL of them! I chose the option "cancel delete files" and them brought back, she says they are all "missing or offline. I tried to 'find' a different folder and it deleted the folder all together and now I don't know where he is. Help, please!

    How to restore pictures that have been deleted from Lightroom, but not removed from the 'drive '?

    You need a backup of your Lightroom catalog file before deleting the photos made. You have such a backup? If so, find the backup catalog, open it (double click on it) and then search for the photos you want and select them and then file-> export catalogue; Then go to your original catalog file, open it and select file-> import from another catalog and points to the catalog that you just exported.

    If you do not have a backup of your catalog file, then the only thing you can do is to import the photos again, and Lightroom will treat them as totally new photos with no editing and no metadata provided by the user.

    Moreover, the idea of importing photos into Lightroom and then later removing them to Lightroom should is limited to photos you will EVER want such a photos that are so overexposed or underexposed or blurred that they are essentially useless. The photos that you care enough to run a task on (including editing) should never be removed from Lightroom.

    Also, how can I restore photos after saving Lightroom.

    Is this the same problem as above, or another?

    I chose the option "cancel delete files" and them brought back, she says they are all "missing or offline.

    Is it possible that you actually deleted pictures from the hard disk, as well as from Lightroom? Anyway, Lightroom cannot find the photos and you first need to find photos on your hard drives and then direct Lightroom to the location of the photo on your hard drive, using these instructions Adobe Lightroom - find folders and files moved or missing

  • How to remove all the photos from my iphone 5?

    How to remove all the photos from my iPhone 5?

    1. Open the Photos app.
    2. Click on the photo or video you want to delete.
    3. Type > delete the Photo.

    Delete several photos

    1. Open the Photos app and press Select.
    2. Click on each photo or video that you want to remove.
    3. Type > delete Photos.

    Delete photos on your iPhone, iPad and iPod touch - Apple Support

  • How to remove all the pictures imported from my I phone 6

    How to remove all the pictures imported from my I phone 6

    Imported from the place where?

    If they were imported from your computer, you remove the same way that you put on there: by syncing with iTunes. to remove them, you need to synchronize an empty folder, or simply turn off the Photo in the form of synchronization option summary pane when the iPhone is connected.

  • How to remove all the exhibitors?

    How to remove all the exhibitors of large document?

    I tried to use find/replace and then find format, but I couldn't find the Exhibitor box.

    In find/replace, in Format to find, go to the basic character Formats section and it is in the drop Position down to the right.

  • How to remove all the transitions?

    I used the automate to sequence with the default transition. A few tens of transitions have been added to the sequence.
    How to remove all transitions without deleting the sequence and starting from scratch, please?

    Thanks in advance.

    Shift + select them and delete them.

    / Roger

  • I used my iMac as a hard drive backup to my macbook once. Now when I update to El Capitan he says that it cannot be updated due to being of a backup. How do I change the drive mode so I can update?

    I used my iMac as a hard drive backup to my macbook once. Now when I update to El Capitan he says that it cannot be updated due to being of a backup. How do I change the drive mode so I can update?

    If you use your iMac as a backup to disk using Time Machine look for a folder called Backups.backupdb.

    It's what keeps you upgraded your operating system, you must remove it.

    Copy everything first if you are on a different drive. It would be wise to create a backup of the iMac on another drive also.

    Check system preferences > Time Machine and make sure that the iMac is not selected as the Time Machine drive.

  • How to remove all separated WinRAR files

    Original title: teach me how to remove all the separate files

    Because of the first time I use the WinRAR, I try to separate a file, but I put the wrong size of file to separate. After that, it separate for 300540 files, so can someone show me how to remove all the separate files.

    Hi Nicolas,.

    Welcome to the Microsoft community.

    I understand that you are using WinRAR and trying to separate files.

    Please see the link.

    Frequently asked questions (FAQS) for WinRAR

    http://www.win-rar.com/FAQ.html?&L=0

    I suggest also please contact the support team of WinRAR for assistance.

    http://www.win-rar.com/contact.html

    Please do not hesitate to contact us if you need help with Windows. We would be happy to help you.

  • Smartphones blackBerry how to remove all my texts received

    Can someone tell me please how to remove all my texts received rather than make them one by one.

    Welcome to the forums

    It is possible to do. Before do you, backup phone data: http://www.blackberry.com/btsc/KB12487

    1. Access your sms/messages folder
    2. Press menu, and then click on "view file".
    3. Go to 'SMS Inbox.
    4. Scroll to the top most sms and click the date above it and "delete prior".

    Voila!

  • How to remove "around the web" pop ups?

    How to remove 'around the web' pop ups of Safari on my macbook air?

    Download and run Malwarebytes Anti-Malware: http://www.adwaremedic.com/index.php

    You can also remove the adware manually by following the steps provided by Apple: https://support.apple.com/en-us/HT203987

    After that, make sure that your default search provider is set to the one you always use. To do this, open Safari - Preferences - research.

    Go to the Safari menu (at the top right of your screen next to the Apple icon), choose 'Quit Safari'

    Press the "Shift" key and while holding this button on your unique keyboard, click the icon of Safari on your Dock.

    Open Safari - Preferences - Privacy - data to remove any Web site.

    Also, I think it would be a good idea to install AdBlock.

  • HP PAVILION NOTEBOOK PC G7: How can I download the driver hp Pavilion notebook form g7 graphics radeon on processor intel

    someone can tell me, how can I download the driver hp Pavilion notebook form g7 graphics radeon on processor intel

    Hello

    What is your Pavilion G7? Please follow the instructions below to find the product/model of your machine:

    http://support.HP.com/us-en/document/c00033108

    Kind regards.

  • How can I get the driver for a Dell Latitude D800 XP wireless?

    I have a Dell Latitude D800 that I just did a clean install of XP SP3 to and the Wireless does not work. How can I get the driver for the card wireless to the computer?

    Download drivers

    Visit the manufacturer's Web site and select your model (this is usually done in the Support section). You should be able to download drivers for your model if they have drivers for your version of Windows. Download the driver and then follow the instructions to install.

    Reference Dell Driver Downloads:

    http://www.Dell.com/support/drivers

  • How can I reinstall the drive extended?

    Windows Media Player

    How can I reinstall the drive extended?

    Hello

    I suggest that refer you to the link provided below to set a Windows Media Center Extender device in Windows Vista.

    http://Windows.Microsoft.com/en-us/Windows-Vista/set-up-a-Windows-Media-Center-Extender-device

Maybe you are looking for

  • Satellite 2450 s203, "Key Blind" vs Alt right

    Hello!I have a problem with my Satellite 2450 s203 keyboard. The sequence of keys on my keyboard is (right): bar space, "blind button", Ins, Del, RightAlt."Blind touch" is the key with any letter/sign on them. When you type, you will get "------" ("'

  • See appeal of latency?

    First of all, let me say I'm sorry if this question has already been answered or if this isn't the right place to post this question. I looked around a bit and can't seem to find good answers. I was wondering if there is a way to see the time of late

  • With Dll handling table

    Hello everyone I did a dll with labview and I call the DLLs in labview only I gave a table of entry and an exit table to the connector pane and made this feature as a dll by adding 100 to the input to the internal array. But when I called this dll in

  • WRT320n disappear from network

    Hello, ives you a question. Week last ived had al ot of the problems with the router WRT160nV2 I changed the router Monday last with a new WRT320N. No problems and the downloadspeed of good wlan al start of 22 MB/s. It al works well until this mornin

  • I can check my browsing history from my computer on another computer

    I have teenagers at home and while at work, I think they are on the sites I prefer not having their go. Is there a way to check the browser history of my home computer that I use at work?