Format drive - the Lazy way

Another day, another quicky. A few new VMs running with additional drives that someone forgot to initialize? Considering RDPing to each of those? Or maybe mmc console (DiskMGMT.MSC) and initializing one by one? Maybe Honolulu will help?

No worries, PowerShell will do just fine. I love those quickies that can save you a few clicks here and there!

The RAW meat

So, basically formatting a drive requires these four steps:

  1. have a disk with raw partition (uninitialized) 😊
  2. initializing the drive
  3. creating new partition, and assigning a letter to it
  4. finally – formatting the drive

Let’s make it usable

Now, if you’re like me and would like to be able to connect to remote machines with different credentials (LAPS!) and format drives with different labels and file systems - there’s a function for you here:

Or You can grab it as part of PPoSh (Polish PowerShell User Group) Module from GitHub or PowerShell Gallery. There’s more goodies in there. If you’ve installed it before (Install-Module PPoShTools), just update it (Update-Module PPoShTools)