Solved

Diskpart script help

Posted on 2014-11-18
3
135 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Suggested Solutions

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now