Site icon

Powershell & Disk Setup

So recently I had to setup some drives but wanted to bypass the traditonal compmgmt route (or diskmgmt).  Powershell proved to be much faster than the old way, it only takes a few seconds to setup an SSD (longer if you want to format).

#which drives are partition style raw?


# so in the above example I noted disk number 4 is RAW, I wanted it to be the N drive
# allocate all space, format as GPT and label it "N-DRIVE"

Get-Disk | Where-object Number -eq 4 | Initialize-Disk -PartitionStyle GPT -PassThru | New-Partition -DriveLetter N -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel "N-DRIVE" -Confirm:$false




Exit mobile version