Skip to content

Automated Diskpart Script using Boot Media

Featured Replies

How to create multiple partition with diskpart? i need to run commnad with text file?

I havent read through all the post.

But im guessing you are after something like this :-)

 

select volume 0 
assign letter=d
select disk 1
online disk noerr
attributes disk clear readonly noerr
clean 
create partition primary noerr
assign letter=e noerr
format FS=NTFS LABEL="Application Volume" QUICK noerr
select disk 2
online disk noerr
attributes disk clear readonly noerr
clean 
create partition primary noerr
assign letter=f noerr
format FS=NTFS LABEL="Database Volume" QUICK noerr
select disk 3
online disk noerr
attributes disk clear readonly noerr
clean 
create partition primary noerr
assign letter=g noerr
format FS=NTFS LABEL="Transaction Volume" QUICK noerr
select disk 4
online disk noerr
attributes disk clear readonly noerr
clean 
create partition primary noerr
assign letter=h noerr
format FS=NTFS LABEL="Bank Volume" QUICK noerr
exit

 

Commandline in task seq:

diskpart /s "%scriptroot%\Custom\DiskPartSCCM.txt

  • 1 month later...

Thanks for your valuable reply! :)

i have one more q?

How can format only c: drive except other drive in TS? How to create the TS in MDT?

  • 1 year later...

A solution inside the Task Sequence would be to use the format.com command from the x: drive. Since the format command is already in the ram (x:) drive it doesn't required to be copied to the encrypted partition, later if you prefer you can rerun diskpart.

 

Command line: FORMAT.com C: /V:System /FS:NTFS /X /Q /Y

 

Start in: x:\windows\system32

  • 3 years later...

Hi how about some settings in you Boot image if you go to the Customisation tab (2012 1511) you can add the following command line

 

cmd /c xcopy.exe *.* X:\ /IERYH & cmd /c Diskpart /S X:\Disk-Part-Clean.txt

 

you will need to add the .txt file on a file share and include the path in the "include files for prestart command"

  • 6 years later...
On 7/27/2016 at 8:55 AM, kirbyrutt said:

Hi how about some settings in you Boot image if you go to the Customisation tab (2012 1511) you can add the following command line

 

cmd /c xcopy.exe *.* X:\ /IERYH & cmd /c Diskpart /S X:\Disk-Part-Clean.txt

 

you will need to add the .txt file on a file share and include the path in the "include files for prestart command"

This helped me a lot, however I am stuck on one part. After Diskpart runs, I need to reboot or I get the same error. However, if it reboots after DiskPart runs, it will run the Diskpart script again  and it is stuck in a loop.  How can I tell it to reboot but not run the Prestart command again?

  • 1 year later...
On 7/27/2016 at 3:55 PM, kirbyrutt said:

Hi how about some settings in you Boot image if you go to the Customisation tab (2012 1511) you can add the following command line

 

cmd /c xcopy.exe *.* X:\ /IERYH & cmd /c Diskpart /S X:\Disk-Part-Clean.txt

 

you will need to add the .txt file on a file share and include the path in the "include files for prestart command"

I don't get involved too much with our SCCM system but I am building a large number of machines and making my own build stick. I'm struggling to work out where I'd put the files that are mapped to X in the above. Would there be a file share mapped during the build process? Could I drop the Disk-Part.Clean.txt file on a folder on the build stick, or at this point in the process can the system not see those folders?

 

Usually we just drop a diskpart.cmd and the txt file on the build stick and press F8 to navigate to it and run it that way, but this obviously looks like a better option.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.