Need partitioning script for unattended install


  1. Posts : 5
    Win10_Insider_?????.???
       #1

    Need partitioning script for unattended install


    Hi

    I already have a working answer file but it works with wiping/formatting the whole disk. Can't figure out how to do this without wiping the disk, it would be useful for friends[remote ones] who like to clean install without interaction. (if one has important files on a single partition or multiple important partitions)

    so a script for:

    1- Looking for multiple partitions

    a1- if one partition is present [only C:] then >

    a?- need to delete existing OS-related files like Program Files (x86)/Program Files/Program Data/Windows/?, boot records, etc because we want to delete only windows files and other OS-related partitions [both for GPT/MBR disks] (so we won't delete Users[Downloads/Desktop, etc] or custom folders)

    a2- Look for empty space ie. 40-80?gb, if present >

    a3- make new partition(s) to install windows.


    b1- if multiple partitions are present [C:/D:/?:] then >

    b2- Look for windows Partition and other OS-related partitions [both for GPT/MBR disks] to delete them >

    b3- make new new partition(s) to install windows.


    c- set(find) identifiers for created partitions for ImageInstall > OSImage > InstallTo step


    2- where to place this script?

    3- adding to the answer file is necessary? it can be self/auto executed?
      My Computer


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

    I've worked out and used something similar to what you are doing for a slightly different purpose. Basically, I make Windows setup run a script that creates custom partitions for me, but even with the script you still need to reference the correct partition numbers in the answer file so I'm not seeing a way around that. Also, the procedure is rather time consuming because you need to mount the boot.wim for Windows PE (used during setup), add your script to it, then integrate that new boot.wim back into your original image.

    Since the answer file still needs to reference the correct partition numbers, it won't let you change those on the fly.

    But if I could make a suggestion:

    How about simply omitting the Windows-Setup > DiskConfiguration and the Setup > ImageInstall > OSImage section from the answer file? This way, the user will be presented the screen where they need to select the location to which Windows will be installed and they can choose what partitions they wish to delete or not delete. Other than just that one item, the entire rest of setup will still be automated.
      My Computers


  3. Posts : 5
    Win10_Insider_?????.???
    Thread Starter
       #3

    hsehestedt said:

    But if I could make a suggestion:

    How about simply omitting the Windows-Setup > DiskConfiguration and the Setup > ImageInstall > OSImage section from the answer file? This way, the user will be presented the screen where they need to select the location to which Windows will be installed and they can choose what partitions they wish to delete or not delete. Other than just that one item, the entire rest of setup will still be automated.
    I've tried helping my friends and my friend's friends but it gets hard when some of them don't know how to interact with windows setup process at all (like me when I got my first PC) so it would be good to place this script and answer file to root of installation media and let them install without single click.
      My Computer


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

    First, thanks for the rep. I do appreciate it.

    I understand exactly what you are saying. I've had to provide support services to many who cannot complete tasks on their own. So how about this...

    Rather than a script, how about simply creating a customized answer file for each of them? I already do something similar for myself. For example, on most of my systems, Windows gets installed on disk 0 so my answer file reflects this. However, on one of my machines, SATA drives get enumerated before NVMe drives and I want to install on an NVMe drive. As a result, I simply modify my answer file to install to disk 4.

    Likewise, you could simply create a customized answer file for each of these users or for different systems.

    In addition, you could remove the option to wipe the entire disk so that other partitions remain intact.

    So, the above is just a general outline, but I have a few questions so that I can give you some more detailed suggestions.

    1) Is your unattended setup just a plain unattended setup of Windows using a single autounattend.xml answer file, or are you deploying a customized sysprep installation of Windows where you have both an autounattend.xml and an unattend.xml answer file?

    2) Would you be able to post your answer file(s) here so that I can make specific suggestions that apply to your particular answer file?

    NOTE: To determine what the disk ID is of the disk you want to install to, I usually do this:

    1) Boot the system from windows installation media.
    2) Proceed with installation up to the point where Windows asks what drive to install onto.
    3) On this screen, you can see how Windows setup has enumerated the disks. Simply note the correct disk and partition numbers from here.
    4) Abort the installation at this point because going any further would actually begin installation which you do not want.
      My Computers


  5. Posts : 5
    Win10_Insider_?????.???
    Thread Starter
       #5

    hsehestedt said:
    First, thanks for the rep. I do appreciate it.

    I understand exactly what you are saying. I've had to provide support services to many who cannot complete tasks on their own. So how about this...

    Rather than a script, how about simply creating a customized answer file for each of them? I already do something similar for myself. For example, on most of my systems, Windows gets installed on disk 0 so my answer file reflects this. However, on one of my machines, SATA drives get enumerated before NVMe drives and I want to install on an NVMe drive. As a result, I simply modify my answer file to install to disk 4.

    Likewise, you could simply create a customized answer file for each of these users or for different systems.

    In addition, you could remove the option to wipe the entire disk so that other partitions remain intact.

    So, the above is just a general outline, but I have a few questions so that I can give you some more detailed suggestions.

    1) Is your unattended setup just a plain unattended setup of Windows using a single autounattend.xml answer file, or are you deploying a customized sysprep installation of Windows where you have both an autounattend.xml and an unattend.xml answer file?

    2) Would you be able to post your answer file(s) here so that I can make specific suggestions that apply to your particular answer file?

    NOTE: To determine what the disk ID is of the disk you want to install to, I usually do this:

    1) Boot the system from windows installation media.
    2) Proceed with installation up to the point where Windows asks what drive to install onto.
    3) On this screen, you can see how Windows setup has enumerated the disks. Simply note the correct disk and partition numbers from here.
    4) Abort the installation at this point because going any further would actually begin installation which you do not want.
    1) only Autounattended.xml file according to Kari's thread
    2) same with Kari's exept Language, User name, etc.

    I also have another Autounattended.xml which includes ModifyPartition(formatting) and InstallToAvailablePartition steps, so no creating partitions, wiping. It works cause I know exactly my PartitionId's that already setted up but that's not the case when I have no idea about their PartitionId's and states (which one is needed) and I can't ask them. Maybe single script (I'll send it) that print PartitionId's for them and then they send me SSs and I may prepare customized Answer files!

    Ty for assistance.
      My Computer


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

    You need to be careful because Windows setup may potentially enumerate the drives differently. Since Windows setup uses Windows PE I suppose that you could create bootable media based upon Win PE that runs a simple diskpart script o capture all the drive and partition info from them.
      My Computers


  7. Posts : 5
    Win10_Insider_?????.???
    Thread Starter
       #7

    hsehestedt said:
    You need to be careful because Windows setup may potentially enumerate the drives differently. Since Windows setup uses Windows PE I suppose that you could create bootable media based upon Win PE that runs a simple diskpart script o capture all the drive and partition info from them.
    once I setted up Partition 1 it hadn't changed at all. I'm using it for at least 2 years.
      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 23:12.
Find Us




Windows 10 Forums