

New-Partition -AssignDriveLetter -UseMaximumSize |įormat-Volume -FileSystem NTFS -NewFileSystemLabel “disk2” -Confirm:$false Initialize-Disk -PartitionStyle MBR -PassThru | The following script accomplishes these four tasks:

Luckily, with Windows PowerShell 3.0 in Windows 8 or Windows Server 2012, I can perform all of these operations via Windows PowerShell functions from the Storage module.

Formatting a new drive can take a bit of time depending on the size of the drive and the type of format being performed. Next, the drive must be partitioned and formatted before it is usable. This is typically a one-time operation, and it does not take very long to accomplish. This occurs, typically when I open the Disk Management utility and a message states that a new drive is detected and must be initialized. For example, the drive needs to be initialized. However, when the virtual machine comes online, there is a bit of work to do to make the drive accessible from within the operating system. In yesterday’s post, Use PowerShell to Add VHDs and Configure New Virtual Machines, I was able to create and add new VHDs to previously existing virtual machines. Microsoft Scripting Guy, Ed Wilson, is here. Summary : Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to initialize raw disks and to partition and format volumes.
