none
Installing Guest OS on Hyper-V VM using Powershell CLI

    Question

  • Hi,

    I've installed the Hyper-V role on My Server Core 2008 r2 setup and have created a VM using the powershel Hpyer-V management library.

    How do I now use the CLI / Powershell to install a New Guest OS onto the VM :-

    [I have given the VM Memory (512GB) a VHD (Fixed 20GB) and have mounted an ISO of Win7U as a DVD on the VM but don't know how to get the VM to install from bootable DVD(Iso Mounted). ]

    When I start the VM it says starting for a while then goes back to stopped status.

    Monday, November 28, 2011 9:41 AM

Answers

  • Hi!

    I might be thinking ahead of your current issue, but are you trying to mount an ISO thats been modified for unattended installation?

    If not, the Win7 installation DVD requires user interaction and I don't think that can be accomplished from the host CLI.

    • Proposed as answer by BrianEhMVP, Moderator Monday, November 28, 2011 3:40 PM
    • Marked as answer by A-E-J Monday, November 28, 2011 4:54 PM
    Monday, November 28, 2011 10:03 AM

All replies

  • Hi!

    I might be thinking ahead of your current issue, but are you trying to mount an ISO thats been modified for unattended installation?

    If not, the Win7 installation DVD requires user interaction and I don't think that can be accomplished from the host CLI.

    • Proposed as answer by BrianEhMVP, Moderator Monday, November 28, 2011 3:40 PM
    • Marked as answer by A-E-J Monday, November 28, 2011 4:54 PM
    Monday, November 28, 2011 10:03 AM
  • Hi,

     

    I agree with Mike. You can create a new VM with PowerShell. However, the operating system installation within the VM requires user interaction even if you use an unattended installation file.

     

     

     

    Best Regards,

    Vincent Hu

     

     

    Monday, November 28, 2011 2:52 PM
  • If there is a blank VHD on the VM then instalaltion should begin, if the the VHD is formatted then the ISO will prompt for use interaction to actually boot into the ISO image (installation media).

    Yes, you will need the console of the VM.

     


    Brian Ehlert (hopefully you have found this useful) http://ITProctology.blogspot.com
    Learn. Apply. Repeat.
    Monday, November 28, 2011 3:41 PM
  • i was hoping that it would be like installing a new OS on a clean physical machine where the OS installation Media bring up its own user interface. So I hope that withing the VM the installation media would bring up its own user interface.

    However I'm not seeing any signs of installation beggining as yet!

    Monday, November 28, 2011 4:10 PM
  • I concur its seems that whether I start the VM with an ISO or Physical CD mounted the its DVD drive all that happens is it goes inst a state of starting and then stopped. so no UI is occuring

    thanks for the help.

    Monday, November 28, 2011 4:54 PM
  • Yes, the VM console does not "just pop up" when you start a VM.

    And the VM console is a subcomponent of the Hyper-V Managment Console - not the community PowerShell cmdlets.


    Brian Ehlert (hopefully you have found this useful) http://ITProctology.blogspot.com
    Learn. Apply. Repeat.
    Monday, November 28, 2011 5:41 PM
  • Do you have any errors in a log somewhere related to the stop event? When a VM is unable to find any bootable media, it just stalls with a "Boot media not available..." console message and blinking cursor, however the VM remains running.

    If you try to start the VM using the Hyper-V console, do you get anything on the VM screen?

    What does the configuration look like, did it actually mount the ISO, so you'll know your powershell script actually worked?

    Monday, November 28, 2011 5:53 PM
  • you could accomplish by using a sysprepped VHD as a template disk rather than using the install media to the blank VHD - if you power on the newly created VM that has a clone of the disk in a syspreped state then it will power on and go thorugh the OOBE state and then you automate this process using your sysprep xml you use when you create the template. The system will boot up, and run any post commands you have included in the sysprep or setupcomplete.cmd. No console required just file copy operation, config of the VM using the new disk and powering it on. -Heres a article that explains how to create your base template if you are not using SCVMM (just straight up Hyper-v

    http://sondreb.com/blog/post/hyper-v-making-template-virtual-machines.aspx

    Sunday, February 12, 2012 12:55 AM
  • How silly of me. I totally forgot about the perfect tool for what you want.

    Wim2VHD 

    The WIM is the base image, can even be extracted from the OS installation media.

    http://archive.msdn.microsoft.com/wim2vhd

    http://blogs.technet.com/b/jamesone/archive/2009/05/27/how-to-install-an-image-onto-a-vhd-file.aspx


    Brian Ehlert (hopefully you have found this useful) http://ITProctology.blogspot.com
    Learn. Apply. Repeat.
    Disclaimer: Backup, test your backup, try new things. Attempting change is of your own free will.

    Sunday, February 12, 2012 1:03 AM