PowerShell: Initialize Raw Disk, Partition, Assign Drive Letter and Format

Here’s a quick script that initializes a raw disk, then partitions, assigns a drive letter, and formats the drive with NTFS.

Get-Disk | `
Where PartitionStyle -eq 'RAW' | `
Initialize-Disk -PartitionStyle MBR -PassThru | `
New-Partition -AssignDriveLetter -UseMaximumSize | `
Format-Volume -FileSystem NTFS -NewFileSystemLabel "Data01" -Confirm:$false
This entry was posted in PowerShell. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *