I added data disks for Azure virtual machines, and I need to create a volume for them.
I used the following code to create the volume:
$disk = Get-Disk | where-object PartitionStyle -eq "RAW"
$disk | Initialize-Disk -PartitionStyle GPT
$partition = $disk | New-Partition -UseMaximumSize -DriveLetter F
$partition | Format-Volume -Confirm:$false -Force
When creating a volume, it asks for confirmation before formatting the disk.
I want to avoid this confirmation window. I tried -Confirm:$false -Force, but it still asks for confirmation.
source
share