I have a Windows 7 image that I want to fully unattend. I'm using ADK for 8.1 if that's of importance. When installing, windows gives the error that it cannot clean the disk because it is currently being used. I have on that disk my previously installed windows. My current autoUnattend.xml is View attachment b0yzDJCqqx.7z
I've had this before. I think it gives you that error if there's a hidden recovery/tools partition. You can always clean it with diskpart 1st & try again. I boot into winpe from usb & run a batch file that cleans the drive & creates all the partition structure I want. My unattend just tells setup which partition to install too. This is much better because you can now add a custom recovery partition to the end of the drive. ie, shrink windows partition my 10gb & create 10gb recovery. Autounattend is limited as it can't shrink...
I have a USB stick in which I use to install windows. I don't know which device, either HDD or USB, will be DISK 0. So, if clean disk 0, it might be the USB and I don't want that.
run diskpart lis dis sel dis 0 cle exit Check 1st with the list disk command. Your HDD/SSD's will always be listed 1st anyway, unless they are not seen & you need to load a driver. Your unattend is trying to wipe disk 0 anyway you realise...
Disc 0 will be the disk which were used for booting the OS and if the OS is on USB Stick, that would be Disc 0!! So, be carefully, check the capacity of the drive and chose the one to clean which you'll need for the installation.
I'm writing a batch right now to find the correct partition. This will look for the partition that has the system flag and select it. Based on the following output, am I correct in assuming that the System flag is always the primary system drive? Regardless of CD/DVD/USB etc. media used to boot. It's basically the place where bootmgr is located, right? My USB is drive G and it contains the ACTIVE flag and is using bootmgr and BCD files. This, however, does not appear as the system. I guess there's no way of fully automating diskpart in finding the primary disk. Code: DISKPART> lis vol Volume ### Ltr Label Fs Type Size Status Info ---------- --- ----------- ----- ---------- ------- --------- -------- Volume 0 F SC2012SP1SC UDF DVD-ROM 1069 MB Healthy Volume 1 C NTFS Partition 50 GB Healthy System Volume 2 D NTFS Partition 415 GB Healthy Pagefile Volume 3 E NTFS Partition 698 GB Healthy Volume 4 G NTFS Removable 50 MB Healthy DISKPART>
How many partition has the HDD? The C Partition is 50GB only!! And how you like to carry on, format/wipe the C Partition only? That would maybe not solve your problem! Best would be to wipe the whole drive and start from 0!
The C and D drives are DISK 0 (i.e. primary disk). I'm trying to automate diskpart to clean DISK 0, thus removing all partitions on it. In this case, C and D would be deleted.