Solved

Diskpart script help

Posted on 2014-11-18
3
167 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
Determining the an SCCM package name from the Package ID
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.
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…

732 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