Home Page

Home Page
How to Search the Query

Monday 24 February 2014

How to Automate Windows Diskpart Commands in a Script

The Windows diskpart command can be Automated using "txt" file, To automate diskpart utility, you need to create a text file with all required diskpart commands.

 
Where we use: 
  • we can use this on local machine but diskpart.txt can be on remote machine (Mapped Network Drive)
  • we can use this while installation of OS using Installation Media OR WDS PXE Boot.
  • we can use on local machine but can be apply on new addtional HDD (disk1)

Here we are going to create a batch file to call diskpart commands using .txt file located on Local or Remote Machine
  1. Steps to create ".txt" file for diskpart commands
  • Open Notepad > copy all below mentioned commands and save as a "diskpart.txt"
list disk
select disk 0
clean
create partition primary size=12000
list partition
select partition 1
format fs=ntfs quick
assign letter=c
active
list partition

     2. Steps to run diskpart.txt file using command
  • Open Command Prompt and type below command to call txt file (If you are using PXE Boot then press shift + F10 to open command prompt)
  • copy diskpart.txt either Local Machine OR Remote Machine (mount Network Dive using command)
Command :  diskpart /s z:\diskpart.txt


___________________________________________________
Searches Related Links: 
How to create diskpart batch file
batch file for diskpart commands
how to create recovery partition using diskpart commands
windows recovery partition automated batch file
batch file for auto mount and format the disk drive
how to format disk drive using diskpart batch file
diskpart batch file to create recovery partition in windows
how to create disk partition using batch file

2 comments:

Thank you for logging in.. Waiting for your valuable views.