none
Scripting the Removal of Physical disk from VM RRS feed

Answers

  • All done

    The script I used for the removal and then re-adding of the physical disk is as follows:

    remove-vmhardDiskDrive-VMName2012r2-ControllerTypeSCSI-ControllerNumber0-ControllerLocation0

    Add-VMHardDiskDrive-VMName2012R2-ControllerTypeSCSI-ControllerNumber0-DiskNumber1-Passthru

    I then automated it with task scheduler to trigger at 6pm everyday (30 minutes after rotation time)

    The ISCSI controller type allows you to run the command whilst the VM is on.

    • Marked as answer by Supa-Dan Tuesday, September 9, 2014 10:10 AM
    Tuesday, September 9, 2014 9:38 AM

All replies

  • What are you asking?  What do you mean by automatically?  The command selects the hard drive.  Read the help for the command.

    http://technet.microsoft.com/en-us/library/hh848470.aspx

    Look at the examples of how to choose the hard drive to use.


    ¯\_(ツ)_/¯

    • Proposed as answer by jrv Monday, September 8, 2014 11:13 AM
    Monday, September 8, 2014 11:13 AM
  • Sorry, If I was being scored points on NOT being very clear, I would have many!

    Basically I want to add a VM Hard drive with the "Physical Hard Disk" option selected. I want to this via the powershell which I can turn into a batch file.

    Monday, September 8, 2014 1:31 PM
  • Sorry, If I was being scored points on NOT being very clear, I would have many!

    Basically I want to add a VM Hard drive with the "Physical Hard Disk" option selected. I want to this via the powershell which I can turn into a batch file.

    What physical hard disk?  VHDs are always created on a physical hard drive.

    Are you asking how to attach a local hard drive to a VM?


    ¯\_(ツ)_/¯

    Monday, September 8, 2014 1:50 PM
  • Yes, its a passthrough which is being added as an ISCI target, the powershell allows me to add it into the VM but I need it to select "physical disk" (last option above)

    Again, 10 points scored for my clarity.

    Apologies for that.

    Monday, September 8, 2014 2:37 PM
  • The code adds the selects physical disk as a physical disk. Read the help carefully.


    ¯\_(ツ)_/¯

    Monday, September 8, 2014 3:13 PM
  • Thanks for your help thus far jrv.

    I'll let you know how I get on.

    Monday, September 8, 2014 3:29 PM
  • All done

    The script I used for the removal and then re-adding of the physical disk is as follows:

    remove-vmhardDiskDrive-VMName2012r2-ControllerTypeSCSI-ControllerNumber0-ControllerLocation0

    Add-VMHardDiskDrive-VMName2012R2-ControllerTypeSCSI-ControllerNumber0-DiskNumber1-Passthru

    I then automated it with task scheduler to trigger at 6pm everyday (30 minutes after rotation time)

    The ISCSI controller type allows you to run the command whilst the VM is on.

    • Marked as answer by Supa-Dan Tuesday, September 9, 2014 10:10 AM
    Tuesday, September 9, 2014 9:38 AM