question

BihLuhHew-0776 avatar image
0 Votes"
BihLuhHew-0776 asked IanXue-MSFT edited

Format Disk without Warning promt

Hi All,

I use PowerShell to format server disk but it keep prompting following message box:

110909-image.png
How to disable the message box?

get-disk -number $DiskNumber | New-Partition -DriveLetter $local:Letter -UseMaximumSize |
Format-Volume -NewFileSystemLabel $local:VolumeName -FileSystem NTFS -AllocationUnitSize 65536 –Force -Confirm:$false


windows-server-powershell
image.png (7.5 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

IanXue-MSFT avatar image
0 Votes"
IanXue-MSFT answered IanXue-MSFT edited

Hi,

Please try the New-Volume cmdlet.

 Get-Disk -number $DiskNumber | New-Volume -FileSystem NTFS -DriveLetter $local:Letter -FriendlyName $FriendlyName

I tested your script and it disabled the dialog box as expected.

Best Regards,
Ian Xue
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.