Share via


Run Diskpart with Run command line in OSD task sequence

Question

Monday, May 30, 2016 12:09 PM

I want to check hdd if does not a 100MB reserved partition, make one. I managed to detect if a hdd has it or not. but I wasn't successful implement it.  I've searched a lot about this but no results has been made. here are what I've tried so far:

  • diskpart.exe /s "a unc path to diskpart.txt"
  • I mounted the .wim file, added diskpart.txt to system32 folder, commited .wim file, updated distribution points, used this line in command line : diskpart.exe /s "%windir%\system32\diskpart.txt"
  • I created a package containing diskpart.txt and added a program to run this command : diskpart.exe /s diskpart.txt

In the first and second ways, I get this error in smsts.log 

DiskPart was unable to open or read the script file

In the third way I get this error :

Failed to run the action: Run Partition fixer package. The request is not supported. (Error: 80070032; Source: Windows)

Please guide me. Thanks

Mahdi. Ghorbanpour http://yektagostarhezare.ir

All replies (5)

Wednesday, June 1, 2016 10:18 AM âś…Answered

I mounted the winPE wim file and added diskpart.txt there, now everything works. Thanks a million

Mahdi. Ghorbanpour http://yektagostarhezare.ir


Monday, May 30, 2016 2:33 PM | 1 vote

- Don't use a UNC path for this. How would a system in WinPE find and [more importantly] access a UNC path?

- Which WIM did you mount?

- Using a package often fails because there are no partitions on brand new systems to download the package to.

The best way to do this is to exactly what the format and partition task does: create a text file of the fly on the X: drive (which is the RAM drive WinPE runs from). To do this, you can use a run command-line task that creates the the file using an echo command. Then, use the created file in your run command-line task that runs diskpart.

Jason | http://blog.configmgrftw.com | @jasonsandys


Tuesday, May 31, 2016 8:45 AM

Hi,

In the second way, try to run this command: Diskpart /s x:\Windows\system32\Diskpart.txt

https://technet.microsoft.com/en-us/library/dn614984(v=ws.11).aspx

Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected].


Wednesday, June 1, 2016 4:27 AM

- Don't use a UNC path for this. How would a system in WinPE find and [more importantly] access a UNC path?

- Which WIM did you mount?

- Using a package often fails because there are no partitions on brand new systems to download the package to.

The best way to do this is to exactly what the format and partition task does: create a text file of the fly on the X: drive (which is the RAM drive WinPE runs from). To do this, you can use a run command-line task that creates the the file using an echo command. Then, use the created file in your run command-line task that runs diskpart.

Jason | http://blog.configmgrftw.com | @jasonsandys

- I mounted the wim file for my operating system image. Should I mount wim file of boot images?

- Can you make a sample for your best way?

Thanks

Mahdi. Ghorbanpour http://yektagostarhezare.ir


Wednesday, June 1, 2016 5:27 AM

This time I checked for my diskpart.txt in windows\system32 directory which wasn't there!! But when I mount the wim file again, It's right there!

I guess I'm mounting the wrong wim file. Which wim file I should mount? Isn't it the one I saved a reference image and choose in task sequence first step? I have only one operating system image and I have already updated my DPs after committing changes.

Mahdi. Ghorbanpour http://yektagostarhezare.ir