Jump to content


  • 0
Mike S

Automated Diskpart Script using Boot Media

Question

I have a semi-quick question. How can I implement an automated solution that executes the diskpart command before the TS begins?

 

We maintain quite a few enctrypted laptops in my organization. As a result, no deployments will run until we perform diskpart. I already have a correct script file in place that will automate the commands needed. What I would like is to automate the actual diskpart command. Currently, once I boot using a USB flash drive, I have to press F8 to get the command window, I then have to switch to the root of the flash drive and type diskpart /s diskpart.txt. I would like this process to be automatic once I boot using the flash drive. How can I do this?

 

Thanks,

Mike

Share this post


Link to post
Share on other sites

Recommended Posts

  • 0

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

Share this post


Link to post
Share on other sites

  • 0

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

Share this post


Link to post
Share on other sites

  • 0

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"

Share this post


Link to post
Share on other sites

  • 0
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?

Share this post


Link to post
Share on other sites

  • 0
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.

Share this post


Link to post
Share on other sites

Join the conversation

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

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.