PowerShell EFI Partition – How to Create Using PowerShell

diskpartpowershelltable-partitioningwindows

I would like to automate a script that creates an EFI partition.

Currently, one step is manual and requires to start DISKPART and execute these commands:

create partition efi size=100 
format fs=fat32 quick label=SYSTEM 
assign letter=S

How can I get the same result using PowerShell? I haven't seen any option in the
New-Partition cmdlet to create an EFI partition.

Best Answer

I suspect this would be the equivalent in PowerShell:

New-Partition -DiskNumber 0 -Size 100MB -GptType "{c12a7328-f81f-11d2-ba4b-00a0c93ec93b}" -DriveLetter "S"
Format-Volume -FileSystem FAT32 -NewFileSystemLabel "SYSTEM" -DriveLetter "S" -Force

Modify as appropriate to suit your use-case.