Using DISKPART & DISM to Clean Install.

Page 4 of 6 FirstFirst ... 23456 LastLast

  1. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #31

    Hello @SIW2,

    SIW2 said:
    It can't find the path because you mistyped system32


    SIW2 said:
    No.

    You also dont need to remove the other drive letters.
    So in your opinion, this should work? . . .

    Code:
    
    diskpart
    select disk 0
    clean
    convert gpt
    
    create partition efi size=100
    format quick fs=fat32 label="System"
    assign letter=S
    
    create partition msr size=16
    
    create partition primary size=30720
    format quick fs=ntfs label="W10"
    assign letter=W
    
    create partition primary size=450
    format quick fs=ntfs label="Recovery"
    assign letter=R
    set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac"
    gpt attributes=0x8000000000000001
    
    create partition primary size=51200
    format quick fs=ntfs label="Data"
    assign letter=D
    list volume
    exit
    
    dism /Apply-Image /ImageFile:F:\Sources\install.wim /index:6 /ApplyDir:W:\ /Compact /EA
    
    W:\Windows\System32\bcdboot W:\Windows /s S:
    
    md R:\Recovery\WinRE
    xcopy /h W:\Windows\System32\Recovery\WinRE.wim R:\Recovery\WinRE
    W:\Windows\System32\REAgentC /SetReImage /Path R:\Recovery\WinRE /Target W:\Windows
    
    exit
    
    
    

    This is more for curiosity now, as I do NOT really need a separate Recovery Partition because it is Enabled and can run from C:\Recovery\WindowsRE.

    Thanks.
      My Computer


  2. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #32

    I have been thinking about this and thought that I might try and Automate it. If it does NOT work, then I can just manually [ Copy & Paste ] perform it.

    At the First Setup Screen I will press Shift + F10 to open the CMD Prompt [ X:\Sources> ].
    Then run Notepad.exe and navigate to the USB Root with the TWO files.

    BOTH the below files will be in the Root of the Bootable USB.
    I will use the Disk_Config.txt file that contains ALL the Diskpart Commands . . .

    Code:
    
    select disk 0
    clean
    convert gpt
    create partition efi size=100
    format quick fs=fat32 label="System"
    assign letter=S
    create partition msr size=16
    create partition primary size=30720
    format quick fs=ntfs label="W10"
    assign letter=W
    create partition primary size=51200
    format quick fs=ntfs label="Data"
    assign letter=D
    list volume
    exit

    . . . and a Disk_Config.bat file that contains the following Script Commands . . .

    Code:
    
    @echo off
    diskpart /s %~d0\Disk_Config.txt
    timeout /t 20
    set "Index_Number=6"
    dism /Apply-Image /ImageFile:%~d0\Sources\install.wim /index:%Index_Number% /ApplyDir:W:\ /Compact /EA
    W:\Windows\System32\bcdboot W:\Windows /s S:
    echo. & echo ^>Processing Complete. Press ANY key to EXIT . . . & pause >nul & Exit

    Finally, I will close [ Red Cross ] the CMD Prompt > Yes to Reboot.

    I decided to do it this way, rather than incorporating ALL the Diskpart Commands into the Script within brackets preceded by echo, and then Piping them to create the Disk_Config.txt, and then using diskpart /s %~d0\Disk_Config.txt.

    This should make the process the most flexible and easiest to amend if needed.

    I will find out if it works when I can test it at the weekend.
    Last edited by Paul Black; 10 Nov 2021 at 19:42.
      My Computer


  3. Posts : 7,607
    Windows 10 Home 20H2
       #33

    Paul Black said:
    Code:
    format quick fs=ntfs label="Data"
    Are you sure format quick fs=ntfs is correct? I found the following output:

    Code:
    DISKPART> format quick fs=ntfs
        0 percent completed
    DiskPart has encountered an error: The parameter is incorrect.
    See the System Event Log for more information.
    DISKPART>
    Source: https://social.technet.microsoft.com...-1ab0b2c3357b/
      My Computer


  4. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #34

    Hello @Matthew Wai,

    Matthew Wai said:
    Are you sure format quick fs=ntfs is correct?

    Did you read the whole thread?
    I have used this in the past WITHOUT any problems.
    NavyLCDR ran TWO versions of what I will be running WITHOUT any problems, BOTH with using the above.
    Last edited by Paul Black; 20 Nov 2021 at 18:27.
      My Computer


  5. Posts : 18,432
    Windows 11 Pro
       #35

    @Paul Black,

    I ran your script all the way through again with the commands to create the recovery partition. After booting into the newly created Windows installation, it still would not recognize the recovery partition and enabled Windows Recovery Environment from C: drive. I would still just leave the commands out that create the recovery partition.

    Code:
    X:\Sources>diskpart
    
    Microsoft DiskPart version 10.0.19041.964
    
    Copyright (C) Microsoft Corporation.
    On computer: MINWINPC
    
    DISKPART> select disk 0
    
    Disk 0 is now the selected disk.
    
    DISKPART> clean
    
    DiskPart succeeded in cleaning the disk.
    
    DISKPART> convert gpt
    
    DiskPart successfully converted the selected disk to GPT format.
    
    DISKPART> create partition efi size=100
    
    DiskPart succeeded in creating the specified partition.
    
    DISKPART> format quick fs=fat32 label="System"
    
      100 percent completed
    
    DiskPart successfully formatted the volume.
    
    DISKPART> assign letter=S
    
    DiskPart successfully assigned the drive letter or mount point.
    
    DISKPART> create partition msr size=16
    
    DiskPart succeeded in creating the specified partition.
    
    DISKPART> create partition primary size=30720
    
    DiskPart succeeded in creating the specified partition.
    
    DISKPART> format quick fs=ntfs label="W10"
    
      100 percent completed
    
    DiskPart successfully formatted the volume.
    
    DISKPART> assign letter=W
    
    DiskPart successfully assigned the drive letter or mount point.
    
    DISKPART> create partition primary size=450
    
    DiskPart succeeded in creating the specified partition.
    
    DISKPART> format quick fs=ntfs label="Recovery"
    
      100 percent completed
    
    DiskPart successfully formatted the volume.
    
    DISKPART> assign letter=R
    
    DiskPart successfully assigned the drive letter or mount point.
    
    DISKPART> set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac"
    
    DiskPart successfully set the partition ID.
    
    DISKPART> gpt attributes=0x8000000000000001
    
    DiskPart successfully assigned the attributes to the selected GPT partition.
    
    DISKPART> create partition primary size=51200
    
    DiskPart succeeded in creating the specified partition.
    
    DISKPART> format quick fs=ntfs label="Data"
    
      100 percent completed
    
    DiskPart successfully formatted the volume.
    
    DISKPART> assign letter=D
    
    DiskPart successfully assigned the drive letter or mount point.
    
    DISKPART> list volume
    
      Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
      ----------  ---  -----------  -----  ----------  -------  ---------  --------
      Volume 0     W   W10          NTFS   Partition     30 GB  Healthy
    * Volume 1     D   Data         NTFS   Partition     50 GB  Healthy
      Volume 2     E   20H2         NTFS   Partition    476 GB  Healthy
      Volume 3                      FAT32  Partition    100 MB  Healthy    Hidden
      Volume 4         W10          NTFS   Partition     30 GB  Healthy
      Volume 5     G   Data         NTFS   Partition     50 GB  Healthy
      Volume 6         SYSTEM       FAT32  Partition    100 MB  Healthy    Hidden
      Volume 7     F   ESD-USB      FAT32  Removable     28 GB  Healthy
      Volume 8     S   SYSTEM       FAT32  Partition    100 MB  Healthy    Hidden
      Volume 9     R   Recovery     NTFS   Partition    450 MB  Healthy    Hidden
    
    DISKPART> exit
    
    Leaving DiskPart...
    
    X:\Sources>dism /Apply-Image /ImageFile:F:\Sources\install.esd /index:6 /ApplyDir:W:\ /Compact /EA
    
    Deployment Image Servicing and Management tool
    Version: 10.0.19041.746
    
    Applying image
    [==========================100.0%==========================]
    The operation completed successfully.
    
    X:\Sources>W:\Windows\System32\bcdboot W:\Windows /s S:
    Boot files successfully created.
    
    X:\Sources>md R:\Recovery\WinRE
    
    X:\Sources>xcopy /h W:\Windows\System32\Recovery\WinRE.wim R:\Recovery\WinRE
    W:\Windows\System32\Recovery\Winre.wim
    1 File(s) copied
    
    X:\Sources>W:\Windows\System32\REAgentC /SetReImage /Path R:\Recovery\WinRE /Target W:\Windows
    Directory set to: \\?\GLOBALROOT\device\harddisk0\partition4\Recovery\WinRE
    
    REAGENTC.EXE: Operation Successful.
    
    
    X:\Sources>diskpart
    
    Microsoft DiskPart version 10.0.19041.964
    
    Copyright (C) Microsoft Corporation.
    On computer: MINWINPC
    
    DISKPART> select volume R
    
    Volume 3 is the selected volume.
    
    DISKPART> remove
    
    DiskPart successfully removed the drive letter or mount point.
    
    DISKPART> select volume S
    
    Volume 2 is the selected volume.
    
    DISKPART> remove
    
    DiskPart successfully removed the drive letter or mount point.
    
    DISKPART> exit
    
    Leaving DiskPart...
    
    X:\Sources>
      My Computer


  6. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #36

    Hello @NavyLCDR,

    NavyLCDR said:
    I ran your script all the way through again with the commands to create the recovery partition. After booting into the newly created Windows installation, it still would not recognize the recovery partition and enabled Windows Recovery Environment from C: drive. I would still just leave the commands out that create the recovery partition.

    I agree. As I mentioned, this was more for curiosity than anything else.

    My Brother-In-Law is dropping the computer off tomorrow night, so I will be performing the process over the weekend.

    I will try my Batch Script and Text file approach first as I am interested if that will work. If NOT, then I will just Copy & Paste the Commands.

    Thanks for your time, effort, and testing on this, it is appreciated.

      My Computer


  7. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #37

    Hello,

    I finally got round to doing this.

    I Assigned the USB in Diskpart as Z:\.

    This is the PB_Desktop_Disk_Config.txt file I used . . .

    Code:
    
    select disk 0
    clean
    convert gpt
    create partition efi size=100
    format fs=fat32 quick label="System"
    assign letter=S
    create partition msr size=16
    create partition primary size=30720
    format fs=ntfs quick label="W10"
    assign letter=W
    create partition primary size=51200
    format fs=ntfs quick label="Data"
    assign letter=D
    create partition primary size=20480
    format fs=ntfs quick label="Image"
    assign letter=I
    list volume
    exit

    This is the PB_Desktop_Disk_Config.bat file I used . . .

    Code:
    
    @echo off
    diskpart /s %~d0\PB_Desktop_Disk_Config.txt
    rem timeout /t 20
    set "Index_Number=6"
    dism /Apply-Image /ImageFile:%~d0\Sources\install.wim /index:"%Index_Number%" /ApplyDir:W:\ /Compact /EA
    W:\Windows\System32\bcdboot W:\Windows /s S:
    echo. & echo ^>Processing Complete. Press ANY key to EXIT . . . & pause >nul

    Here is the Output . . .

    Code:
    
    Microsoft DiskPart version 10.0.18362.1
    
    Copyright (C) Microsoft Corporation.
    On computer: MINWINPC
    
    Disk 0 is now the selected disk.
    
    DiskPart succeeded in cleaning the disk.
    
    DiskPart successfully converted the selected disk to GPT format.
    
    DiskPart succeeded in creating the specified partition.
    
      100 percent completed
    
    DiskPart successfully formatted the volume.
    
    DiskPart successfully assigned the drive letter or mount point.
    
    DiskPart succeeded in creating the specified partition.
    
    DiskPart succeeded in creating the specified partition.
    
      100 percent completed
    
    DiskPart successfully formatted the volume.
    
    DiskPart successfully assigned the drive letter or mount point.
    
    DiskPart succeeded in creating the specified partition.
    
      100 percent completed
    
    DiskPart successfully formatted the volume.
    
    DiskPart successfully assigned the drive letter or mount point.
    
    DiskPart succeeded in creating the specified partition.
    
      100 percent completed
    
    DiskPart successfully formatted the volume.
    
    DiskPart successfully assigned the drive letter or mount point.
    
      Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
      ----------  ---  -----------  -----  ----------  -------  ---------  --------
      Volume 0     E                       DVD-ROM         0 B  No Media
      Volume 1     W   W10          NTFS   Partition     30 GB  Healthy
      Volume 2     D   Data         NTFS   Partition     50 GB  Healthy
      Volume 3     S   SYSTEM       FAT32  Partition    100 MB  Healthy    Hidden
      Volume 4     Z   Win10_1909_  NTFS   Removable   7646 MB  Healthy
    * Volume 5     I   Image        NTFS   Partition     20 GB  Healthy
    
    Leaving DiskPart...
    
    Deployment Image Servicing and Management tool
    Version: 10.0.18362.1
    
    Applying image
    [==========================100.0%==========================]
    The operation completed successfully.
    
    Boot files successfully created.
    
    >Processing Complete. Press ANY key to EXIT . . .
    
    

    Worked great, EXCEPT, I can't get it to carry on and complete the installation.

    I [ Red Cross ] the CMD Prompt > Yes to Cancel the Installation.
    It Reboots and I end up back at the Language Screen. I continue, and when I get to the Where do you want to install Windows, it says The Selected Disk is of the GPT Partition Style, and I can NOT get ANY further.

    Am I missing something really easy?

    Thanks.
      My Computer


  8. Posts : 7,607
    Windows 10 Home 20H2
       #38

    The output of the script says "DiskPart successfully converted the selected disk to GPT format."
      My Computer


  9. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #39

    I know, but it will NOT let me get ANY further, as per my post above?
      My Computer


  10. Posts : 7,607
    Windows 10 Home 20H2
       #40

    Paul Black said:
    when I get to the Where do you want to install Windows, it says The Selected Disk is of the GPT Partition Style
    Do you mean something like the following?



    Source: (2021 FIX) Windows Cannot be Installed to This Disk. The Selected Disk is of GPT Partition Style - EaseUS
      My Computer


 

  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:14.
Find Us




Windows 10 Forums