Problem creating GPT VHD automatically

Page 2 of 4 FirstFirst 1234 LastLast

  1. Posts : 11,247
    Windows / Linux : Arch Linux
       #11

    Hi there
    would it work if you install the WSL (shouldn't be a problem as you have HYPER-V) and then run a Linux script using standard cmdline program such as parted for partitioning.

    try something like this from the WSL

    parted --script /device \
    mklabel gpt \
    mkpart primary 1MiB 100MiB \
    mkpart primary 100MiB 200MiB \
    ...

    cheers
    jimbo
      My Computer


  2. Posts : 15,487
    Windows10
    Thread Starter
       #12

    jimbo45 said:
    Hi there
    would it work if you install the WSL (shouldn't be a problem as you have HYPER-V) and then run a Linux script using standard cmdline program such as parted for partitioning.

    try something like this from the WSL

    parted --script /device \
    mklabel gpt \
    mkpart primary 1MiB 100MiB \
    mkpart primary 100MiB 200MiB \
    ...

    cheers
    jimbo
    Thanks but as I said a couple of posts back, issue is sorted.
      My Computer


  3. Posts : 17,661
    Windows 10 Pro
       #13

    cereberus said:
    Thanks but as I said a couple of posts back, issue is sorted.
    @Martin, just a tip:

    Next time you do a clean install, update it fully, add optional features, and when done, capture it to WIM file. Deploying that WIM to a native boot VHD has all drivers, optional features and your settings.

    Kari
      My Computer


  4. Posts : 15,487
    Windows10
    Thread Starter
       #14

    Kari said:
    @Martin, just a tip:

    Next time you do a clean install, update it fully, add optional features, and when done, capture it to WIM file. Deploying that WIM to a native boot VHD has all drivers, optional features and your settings.

    Kari
    I know I can do this but tbh not worth it as Insider versions are so frequent.
      My Computer


  5. Posts : 17,661
    Windows 10 Pro
       #15

    cereberus said:
    I have a script which produces a diskpart script to create a virtual hard drive.
    @Martin, I would appreciate if you could test this PowerShell script of mine:

    Download

    Reading it in OneDrive, all remarks and comments are clearly shown as green. I recommend reading all remarks. Most important thing is variables in lines 78 to 80:

    Problem creating GPT VHD automatically-image.png

    In lines 209 to 222, you tell the script which Windows optional features will be added to Windows image and VHD:

    Problem creating GPT VHD automatically-image.png

    Please test the script and tell me what you think about it. Download the script, unblock it (important!), right click it, and select Run with PowerShell.

    Kari
    Last edited by Kari; 15 Jul 2020 at 14:53. Reason: Fixed bad download link
      My Computer


  6. Posts : 15,487
    Windows10
    Thread Starter
       #16

    Ok at weekend.
      My Computer


  7. Posts : 17,661
    Windows 10 Pro
       #17

    cereberus said:
    Ok at weekend.
    Thanks in advance. We have been generally speaking quite often interested in same topics, I relly appreciate if I can hear your comments.

    The script will create either an MBR or GPT VHD, add host drivers to it, add optional features, apply an unattend.xml file if present in WIM folder, and finally deploy Windows to VHD and add it to Windows boot menu.

    An ISO will not be created, because it is not needed. Notice that although hypervisor and Hyper-V do not be enabled, this script needs Hyper-V PowerShell module being enabled:

    Problem creating GPT VHD automatically-hyper-v-ps-module.jpg

    Kari
      My Computer


  8. Posts : 4,187
    Windows 11 Pro, 22H2
       #18

    Kari, that sounds like a great script. I wrote one for myself that does a lot of the same operations but I'm missing the adding of optional features and applying an answer file. Also, mine is not written in PowerShell.

    By any chance, would you have any specific suggestions of good learning resources for PowerShell? That's something I need to badly work on but a lot of the material I'm finding is not of great quality.
      My Computers


  9. Posts : 17,661
    Windows 10 Pro
       #19

    hsehestedt said:
    By any chance, would you have any specific suggestions of good learning resources for PowerShell? That's something I need to badly work on but a lot of the material I'm finding is not of great quality.
    A good place to start: Getting Started with Microsoft PowerShell | Channel 9

    When done, continue here: Advanced Tools & Scripting with PowerShell 3.0 Jump Start | Channel 9

    I've also written a tutorial about PS scripting basics: PowerShell Scripting - The Basics

    These two tutorials might give some additional tips:


    Kari
      My Computer


  10. Posts : 4,187
    Windows 11 Pro, 22H2
       #20

    Fantastic. Thanks!
      My Computers


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 17:25.
Find Us




Windows 10 Forums