Q: How can I initialize and format a volume using Windows PowerShell?

A: If you need to initialize and format a volume using PowerShell, use the following:

First, get a list of the disks so you know which disk number you want to initialize:

  1. Get-Disk

Next initialize the disk which by default will use GPT:

  1. Initialize-Disk 1

Next create the partition, format, label and assign a different drive letter if required:

  1. New-Partition -DiskNumber 1 -AssignDriverLetter -UseMaximumSize
  2. Format-Volume -DriveLetter E -FileSystem NTFS
  3. Set-Volume -DriveLetter E -NewFileSystemLabel "Pagefile"
  4. Set-Partition -DriveLetter E -NewDriveLetter P