Last active
May 28, 2016 06:31
-
-
Save guitarrapc/3755ade7430fef73964d3f124430acf3 to your computer and use it in GitHub Desktop.
Don't use Diskpart anymore. Please to all.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$diskName = "Crucial"; | |
$driveLetter = "D"; | |
Get-Disk | where FriendlyName -match $diskName | Clear-Disk -RemoveData -RemoveOEM -PassThru | Initialize-Disk -PartitionStyle MBR -PassThru | New-Partition -UseMaximumSize -DriveLetter $driveLetter | Format-Volume -FileSystem NTFS -NewFileSystemLabel Volume -Force; | |
<# | |
# Output Sample | |
DriveLetter FileSystemLabel FileSystem DriveType HealthStatus OperationalStatus SizeRemaining Size | |
----------- --------------- ---------- --------- ------------ ----------------- ------------- ---- | |
D Volume NTFS Fixed Healthy OK 465.61 GB 465.76 GB | |
#> | |
# may better add | where BootFromDisk -eq $false like following | |
Get-Disk | where FriendlyName -match $diskName | where BootFromDisk -eq $false | Clear-Disk -RemoveData -RemoveOEM -PassThru | Initialize-Disk -PartitionStyle MBR -PassThru | New-Partition -UseMaximumSize -DriveLetter $driveLetter | Format-Volume -FileSystem NTFS -NewFileSystemLabel Volume -Force; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sample