Solved

Diskpart script help

Posted on 2014-11-18
3
143 Views
Last Modified: 2014-12-03
I have a txt file that has this

select disk 0
clean

create partition primary size=100
select partition 1
format quick fs=ntfs label="System"
assign letter=S

active

create partition primary
select partition 2
format quick fs=ntfs label="Windows"
assign letter=W
list volume
exit

And to run this as a script

i use diskpart.exe /s WipeC.txt

BUT i am booting of a usb with a label name "images"

This has only happen one time but my script wiped my usb because it was disk 0.

Is there a way to check if disk 0 is label "images" if it is DON'T wipe it.
0
Comment
Question by:armasmike
  • 2
3 Comments
 
LVL 37

Expert Comment

by:Neil Russell
ID: 40450612
A "DISK" does not have a label, a partition has a label.  so that is no use and diskpart does not know about labels.

You could run a diskpart script that just listed out the DISKs to a text file and then parse the textfile to decide what disk to wipe.
0
 
LVL 37

Accepted Solution

by:
Neil Russell earned 500 total points
ID: 40450626
Just having a quick look around and there is a great Microsoft Technet article here
that describes using PowerShell to automate a very similar DiskPart process.

Have a read and you should be able to adapt.
0
 

Author Comment

by:armasmike
ID: 40452164
I have not learn PowerShell yet. it's on my bucket list but at this time can i output the diskpart info to a text file then use vbs to find out id Disk 0 is label name "images" if so DON'T Wipe it and stop.
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question