Remove-hard drive - confirm the $false woes


Having some problems getting this working (4.1 u1); I was wondering if some soul could help.

Remove-hard drive - whatif - confirm $false - hard drive (Get-disk hard - VM vTest2 |?) {} $_. ({Name - eq ' Hard disk 2 "})

This is my code at the moment (see above), I try to get the - confirm the value of the $false according to the document:

I can get it works fine without the - confirm $false, but he invites me to a dialogue of the type "are you sure y/n"; as I need to run it in a script I have to disable the confirmation.  Please can someone help me with what Miss me?

For reference, I pulled the code here:

Thank you!



That must be - confirmed: $false

Tags: VMware

Similar Questions

  • Computer no longer recognizes my removable hard drive to the top

    have a hp pavilion desk top.  power lost the other day. now when I try to make a backup of my computer does not recognize drive.  the light on the removable drive used to Flash, but now it is lit solid.  When I go to properties it says device working properly, but does not fill a volume.  It won't let me eject, he says in use.  any help would be appreciated


    Sounds like his "stuck" in the current state. Try this: go to control panel, select Device Manager. When this window opens, navigate to the tab for your removable drive (try the category of portable devices), and when you find, right-click on the drive and select turn off first, confirm the deactivation, then right-click again and select uninstall, confirming again. When the device has been turned off and deleted, restart your computer with the drive connected to the USB port in what he normally resides. It recognizes the drive now?

    Post your results here and let me know how you fare.

    Kind regards


  • Safari is frozen with a notice that I have a virus Zeus on my MacBook Pro circa 2007 Lion running. How can I get rid of him. Instructions on the page including a number of Microsoft. Restart is not working or 'remove hard drive' as the threat of the page.

    I tried to not restart, no luck. Cannot trash page. Don't know what to do.

    You do not have a virus, given history and the clear, or just Safari Web site relaunch Safari with the SHIFT key is pressed.

  • Remove-hard drive, cant pass a string to it, is there another way?

    I was thinking of using Get-hard drive and then channelling it to Remove-hard drive, but I don't know how to get only the text VMDK * wink *. The below script used to work a few months ago, I'm not sure what has changed, no upgrade were made.

    The code in question:

    $DisksToRemove = (get - VM VM1, VM2, VM3 |) Get - Harddisk)

    foreach ($disk in $DisksToRemove)


    if($Disk.) Filename-comme "* wink *")


    Remove-hard drive - HDD $disk. Filename-confirm: $false

    Write-Host "Removed:"-to the first 'green' plan ".

    Write-Host $disk. File name



    In addition, you could add this to your existing code and it should work

    $DisksToRemove = (get - VM VM1, VM2, VM3 |) Get - Harddisk)

    foreach ($disk in $DisksToRemove)


    if($Disk.) Filename-comme "* wink *")


    $disk: Remove-hard drive - confirm: $false

    Write-Host "Removed:"-to the first 'green' plan ".

    Write-Host $disk. File name



  • Script to remove hard drives as HDD1 of VM and Add again.

    Hi, I tried to write the script to stop the virtual machine and then remove the hard drives as HDD1 and then again add back, here's my script (not yet completed)

    $vmname = testvm02

    Get-VM-name $vmname | %{

    Write-Host 'Stop of the VM' $vmname

    $vmname | Get-VMGuest | where {$_.} State - eq "Running"} | Stop-VMGuest-confirm: $false

    $HDD = get-disk hard - VM $vmname | Hard drive remove

    above script remove all disks that are attached to the VM I want not, I want to only remove that hard hard disks Disk1.

    Can someone please help me to write this script

    its been... Thanks for all the entries

    Here is the script...

    $vmname = get-Content - Path "VM.txt".

    {foreach ($VM to $Vmname)

    $getVM = get-VM-name $VM

    Write-Host 'Stop of the VM' $VM

    $getVM | Get-VMGuest | where {$_.} State - eq "Running"} | Stop-VMGuest-confirm: $false


    #Wait for the virtual machine to poweroff

    $Shutdownvm = get-VM-name $VM

    $powerstaus = $Shutdownvm.PowerState

    Write-host "pending the judgment of the $VM.

    sleep 5

    } until ($powerstaus - eq "PoweredOff")

    $HDDfile = get-disk hard - VM $VM | Where-Object {$_.} Name - not "Hard Disk 1'} | Select file name

    #$HDDpath = $HDDFile.FileName

    Write-Host "Remove the hard disks in the virtual machine" $VM

    Get-disk hard - VM $VM | Where-Object {$_.} Name - not "Hard Disk 1'} | Remove-hard drive - confirm: $false

    {foreach ($HDD to $HDDfile)

    $HDDpath = $HDD. File name

    Write-Host 'Add the disk to the VM' $VM

    New-disk-hard - VM $VM - DiskPath '$HDDpath '.


    Write-Host 'starting VM' $VM

    Start-VM $getvm


  • Why do not the remove-hard drive remove a disc with a new SCSI controller?

    Hi PowerCLI gurus,

    I try to use PowerCLI to automate the solution for article configuration of disks to use VMware Paravirtual (PVSCSI) SCSI adapters (1010398).

    Remove-hard drive sometimes gives me a misleading error when I use it to remove a hard drive with a new SCSI controller.

    The FlatHardDisk specified 'Hard disk 3' no longer exists, or never existed.

    Can anyone here explain the error?

    My version of vCenter server is 5.1.0.

    My PowerCLI version is 2.0.

    Here's what I've done to reproduce the error.

    First of all, I connect to vCenter and stop the virtual machine.

    $TestVM = 'TESTVM '.

    $TestServer = ' vcenter - test.local ".

    SE connect-VIServer-Server $TestServer

    Stop-VM - $TestVM VM - confirm: $false

    I add a new hard drive and store it in a variable so I can refer to it for the next steps.

    New hard drive '.

    -VM $TestVM '

    -Persistent persistence"

    -Flat DiskType '

    CapacityKB - 1024'

    StorageFormat - thin '

    -OutVariable TempDisk

    I make a note of its name.


    Because my VM already has 2 discs, the output is "hard drive 3.

    Then I add a new SCSI controller on the hard drive.

    New SCSI controller.

    Hard drive - $TempDisk '

    -Type ParaVirtual '

    NoSharing - BusSharingMode

    Now, I try to remove the hard drive from the variable to remove the disc.

    Remove-hard drive - hard drive $TempDisk - DeletePermanently-confirm: $false

    It fails with an error that says "Hard drive 3" has already been removed.

    Remove HDD: 12/02/2014-18:51:33 remove-hard drive the FlatHardDisk specified 'Hard disk 3' no longer exists, or never existed.

    On line: 1 char: 1

    + Delete-hard drive - hard drive $TempDisk - DeletePermanently-confirm: $false

    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo: ObjectNotFound: (3:FlatHardDiskImpl drive) [Remove-hard drive], VimException

    + FullyQualifiedErrorId: Client20_VirtualDeviceServiceImpl_TryValidateDeviceExists_DeviceDoesNotExist, VMware.VimAutomation.ViCore.Cmdlets.Commands.RemoveHardDisk

    But I see that there are still "hard drive 3"!

    Get-disk hard - VM $TestVM - name 'hard drive 3.

    CapacityGB persistence Filename

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

    0.001 persist... B-DATA-01] TESTVM/TESTVM_9.vmdk

    Is this a bug or am I missing something?

    I don't think that the cmdlet uses actually the UID, but more likely a MoRef to the vSphere object that represents the hard disk.

    Remember that under the covers most of the PowerCLI cmdlets do calls to the vSphere API.

    Change the Uid, property value indicates that the hard drive connected to the new controller is a new and different purpose.

    And this explains why the hard drive remove does not work with the original hard disk object, it no longer exists.

  • Pavilion ze5730us laptop: how to remove the hard drive of the computer laptop Pavilion ze5730us

    Can anyone tell please how to remove the hard drive of the computer laptop Pavilion ze5730us?  I know its under the keyboard somehow, but I don't know how or where that open.  I could not find this model on YouTube either.

    Thanks in advance for your help.



    The only manual that I could find is one that covers the ze5600.

    See if it will work for your model too.

  • Cannot remove the hard drive from the case

    Acer Aspire AT3-605-UR22

    with the slide in front of the Bay of hard drive enclosure. I have a second hard drive in the traction of front loading Bay. For the life of me I can't figure out how to remove the hd enclosure!



  • I currently store my pictures on and an external hard drive.  Lightroom 6 was not able to find the picture momentarily files.  I inserted an external Flash DRIVE after removing the hard drive and the computer renamed the stick with the same drive letter t

    Redesign existing external hard disks and still 6 Lightroom able to find existing photos.

    I currently store my pictures on and an external hard drive.  Lightroom 6 was not able to find the picture momentarily files.  I inserted an external Flash DRIVE after removing the hard drive and the computer renamed the stick with the same drive letter that has been designated by Lightroom to store my photos.  I could go into my Windows 10 and reset the player to the letter that Lightroom has given at the beginning of the external hard drive.   However, I know this can happen again, if I connect any stick USD or another device, while the external hard drive is not connected to my laptop.   I found the information that I can do the new designation of the final drive by choosing a letter it is 1/2 way or higher in the alphabet.   I would like to turn an external hard drive on a strong letter, warns we hope this previous problem.   My question is, if I already have a lot of pictures on this external hardrive with the designation of the current drive, how it becomes a higher letter and have 6 Lightroom recognizes files, now under the new designation of drive letter without having to go to each photo individually and manually force Lightroom 6 find each photo.  It would take more time than I'd like to lose.  Is there a way to get just 6 Lightroom to recognize the new disk designation has changed and is able to find all of the existing files?

    I have read the ADOBE LightRoom 6 manual and seem not to be able to find anything on how to do it.

    Any help would be welcome.

    Thank you!

    So in Windows, you can select a drive like q letter (or any other letter you want only towards the end of the alphabet)

    Then in Lightroom, you can reconnect to the photos on q: the following instructions (see specifically 4 Figure and related text)

    Adobe Lightroom - find moved or missing folders and files

  • OK, I did something "stupid." The hard drive on my computer was full so I copied my pictures to a removable hard drive. Then I deleted them on my mac. I also wanted a new installation of LR, so I uninstalled that too. I reloaded LR and reloaded my drink "

    OK, I did something "stupid." The hard drive on my computer was full so I copied my pictures to a removable hard drive. Then I deleted them on my mac. I also wanted a new installation of LR, so I uninstalled that too. I reloaded LR and reloaded my 'catalogue', but I don't know how to do so that he can look at the pictures on my external HD help!

    wendyh81856794 wrote:

    Oh, okay, I think I got it. If the folders on my computer with the? Use the LR 'catalogue' on my computer, and when I reconnect them, LR uses the 'catalogue' on my external hard drive?

    No Lightroom does not use a different catalog.

    We discuss records, are we not? In the original catalog, you have a folder with one? mark, say C:\Photos, and you used your operating system to move it to F:\Photos. Lightroom has this record showing under the C:\ drive. As soon as you make the reconnection, Lightroom indicates the folder in the drive F:\.

    Oh, and is there a way to do all the files at once? or what I need to do one at a time?

    See Figure 4 and the corresponding text in the document I linked to.

  • Cannot physically remove the hard drive from the Pavilion dv4-1430us

    The disk hard origianal in this Pavilion dv4-1430us makes mechanical noises, so I will try to replace it with a new one.  I checked the owner's manual supplied with the dv4-1430us, and it gives these instructions (here condensed): 1) remove the power cord and disconnect the battery, 2) remove the hd plastic cover, 3) remove three screws of hard drive now the hd casing in place and 4) pull hard hd tab to the left then go out.

    The problems are: A) there is no hard drive to draw labels, and B) after you remove the three screws, can't do the hd if I push on it to move to the right or remove it from the left.  I don't want to use tools like screwdriver large flat blade or bars of little Crow because it seems like that would probably break something.  Does anyone know how to remove the hard drive of this particular model without breaking something?


    Thanks for a very detailed and quick response.  It turns out the indications that I read in the manual, your statements and mine were all in line to exert a force on the hard drive in the direction indicated by the red arrow on your image.  (A picture is worth a thousand words and your supplied photo clarity that my summary of instructional text has not.)  I decided to take a picture of the entire hard drive in my dv4-1430us (see below) to show that there is no close tab Mylar pull, as there is on the photo you condition.   (The same gray metal tab that appears in your photo, but no mylar tab).

    Apparently my dv4-1430us had some differences at its Assembly of HD compared to yours.  As you can see, the structural elements that surround the HD are very similar to those of your photo, but there is no narrow mylar like in your photo tag.  There is a dark mylar or similar film plastic on top of my HD, and there is a triangle of silver color at the bottom right of this film that points in the same direction as your red arrow.  I tried lifting up the end of this film, mylar and pulling that direction (to the right in this picture), but a part of it (in the upper right corner of this photo) began to tear.  As the film seems to only be glued on the top edge of the caddy HD (also called frame or cage in some articles), I doubted that the show was strong enough to eliminate the stress of a closed winching.  A comrade who has put a video on YouTube showing this procedure also indicated that he had torn this layer of film when he first attempted to remove the HD.  Because I assume that the dark film has a purpose (static protection?)  I gave up shooting at the right edge of the film.

    However the consistency of the instructions in the manual, the instructions on this YouTube video and instructions in your answer on the direction in which the Assembly needed to move HD gave me the courage to put a force pushing the HD in the direction of your red arrow.  To do this, I placed the tip of a flat blade screwdriver large (blade about 5/16 "wide) at the points indicated at the ends of the two yellow arrows in my picture.  In these positions, the blade of screwdriver pushed against the HD box and not the hard drive itself.  Each of these two places, I gave him some very closed but controlled scrimmages, and HD finally moved in the direction of your red arrow as it is supposed to.  I then lifted all of the HD and replaced the HD without incident.

    The action drag the new HD in place was much easier that it was removing the original HD for the first time.  It was perhaps because of some hard rubber padding that has been placed on each side of the original HD assembly that makes for a very tight fit.

    I hope that this description is useful for others who do not have used mylar tab in their computers laptops dv4 and those whose HD assemblies are very tight in.  Thanks again for your quick response that gave me enough comfort to move forward.

  • Remove hard disk while the VM is on

    I have a requirement for the removal of a hard disk of a VM to script while it is running. I can do this OK the client virtual infrastructure, but if I try and get the PowerCLI I get an error that the operation cannot be performed while the virtual machine is on. Any ideas on how to work around this problem? Here are the commands I'm using:

    $hd = get-disk hard - vm myvmname | where {$_.} Name - eq 'hard drive'}

    Remove-hard drive - disk hard $hd - confirm: $false

    I am running 4.0U1 PowerCLI and the latest version of vSphere, ESXi and vCenter.

    Thank you


    You can remove hard drives a guest under tension when the disks are connected to a SCSI controller.

    For IDE hard drives that won't work.

    And you are right, that the cmdlet Remove-hard drive does not seem to be taken into account.

    It will remove only the hard drives when the host is turned off.

    But you can use the SDK ReconfigVM_Task method.

    $vmName = "MyVM"
    $hdName = "Hard disk 3"
    $vm = Get-VM $vmName | Get-View
    $tgtdev = $vm.Config.Hardware.Device | where {$_.DeviceInfo.Label -eq $hdName}
    $dev = New-Object VMware.Vim.VirtualDeviceConfigSpec
    $dev.operation = "remove"
    $dev.device = $tgtdev
    $spec = New-Object VMware.Vim.VirtualMachineConfigSpec
    $spec.DeviceChange += $dev


    Blog: LucD notes

    Twitter: lucd22

  • What is the largest hard drive or the RAID supported by El Capitan and Yosemite?

    What is the largest hard drive or the RAID supported by El Capitan and Yosemite?  Also, WHERE can I find this specification?  Drobo claims that 16 TB is the largest external RAID supported and I do not.

    FYI............ 2 UPDATES since I posted this question:

    "1. Drobo has updated their FIRMWARE to allow now to 'beyond' 64 power to RAID".  Thus, their original 16 TB limit has now been replaced by their new limit of 64 to.  Also note that when you use a Drobo, Apple Mac OS does correctly shows space 'Drive' and the 'free space', if the Drobo 16TB exceeds the size; but the Application DashBoard of Drobo displays the correct numbers.  For example, my Drobo 5 d contains 5, 8 TB disks, for a total size beyond 40 to RAID (theoretically, since most of us should know, now, that the ACTUAL SIZE IS SLIGHTLY SMALLER than THE THEORETICAL SIZE).  AVAILABLE FOR USE ACTUAL SIZE IS ONLY 28.9 TB.  Thus, 40-28, 9 = 11.1 TB gets used in place for the PROTECTION of RAID beyond and the difference between REAL SPACE and SPACE THEORY.  It IS NORMAL because any RAID 5 device always uses about 1 size of hard drive for its Protection.  So, knowing this, the DeskTop icon showing 28.9 TB disk space and free space as everything that is not yet used.  However, instead, the Mac OS shows 70,37 TB disk space and free space like 68,37 TB, which are both incorrect.  Although I'd love it if Mac OS has been magically increase my disk space, in fact, these two numbers are false.  Drobo knows this, and Apple has not, in my discussions with both.  So I hope, between the two companies, that this problem can be corrected.

    2. after many hours on the phone with Apple Support, through no less than 6 people including 2 senior advisers, NONE OF THEM COULD ANSWER MY QUESTION ON CE WHO IS MAXIMUM ALLOWED HARD DRIVE or RAID SPACE AUTHORIZED BY Yosemite and El Capitan.  For me, THIS IMPORTANT FACT SHOULD SIMPLY BE LISTED IN THE OS SPECIFICATION TECHNIQUE, it's quick and easy to read on the Support Site.  But Apple is the new bureaucracy, they are, I don't see what is happening any time soon.  So, be aware that, for now, HE IS No. LIMIT ON SIZE, as an Apple adviser said; but could not confirm in writing; and, IT IS AN INCORRECT DISPLAY SIZE AND FREE SPACE, if your drive is greater than an unknown 16 + TB in size.  Note that I have 3 other RAIDs that are properly in place showing that 9 TB, TB 12 and 18 to size; but I do not know how the SIZE IS IMPORTANT to ensure that the operating system display it correctly, except for my Drobo TB 40.  So, the bottom line, somewhere between to 18 and 40 to is where he goes wrong, in its display of sizes.

  • How can I get all the files from the hard drive in the non-working Compaq Presario CQ62-411NR

    Ice tea seep keyboard laptop, and after drying it feeds on. If I try a hard reboot, it is stated that I would lose all the info in the memory and I can't afford to lose my mother pictures that are on the hard drive. Is it possible to get the hard drive to work in some other way so that I can get my photos and other files.

    You can remove the hard drive and put it in a USB Enclosure.Plug USB port, another machine, where you should be able to go through it and copy your photos off on the hard drive of the host computer.

    Example: & catid = 2783

  • 2nd hard drive for the Satellite Pro A200


    I have the Satellite pro A200 (PSAE4E-03401FDU). The LT has an option for a 2nd hard drive, but it is not included a cable.
    Someone knows the reference to the 2nd hard drive cable?
    Thank you!

    Stand by.
    When you remove the HARD drive to the second HDD can see HDD SATA conector?

Maybe you are looking for