?
Solved

Diskpart script help

Posted on 2014-11-18
3
Medium Priority
?
184 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 2000 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

This article summaries thoughts and ideas from two years of sustained use. It provides good reasoning to make the jump to Windows 10.
Windows 10 Creator Update has just been released and I have it working very well on my laptop. Read below for issues, fixes and ideas.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
Suggested Courses

752 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