Skip to content

Instantly share code, notes, and snippets.

@vermashi
Created August 13, 2018 23:48
Show Gist options
  • Save vermashi/c9080c6549cf3f36d14e034703ec9521 to your computer and use it in GitHub Desktop.
Save vermashi/c9080c6549cf3f36d14e034703ec9521 to your computer and use it in GitHub Desktop.
Format all uninitialized disks with an MBR partition table and an NTFS partition
$sizeInBytes = (((16 * 1024) * 1024) * 1024) - 1
Get-Disk | Where-Object PartitionStyle -eq "RAW" | Where-Object Size -gt $sizeInBytes | Initialize-Disk -PartitionStyle MBR -Confirm:$False -PassThru | New-Partition -AssignDriveLetter -UseMaximumSize | Format-Volume -FileSystem NTFS -Confirm:$False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment