Format Disk without Warning promt

Bih Luh Hew 1 Reputation point
2021-07-01T09:17:17.397+00:00

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 for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2021-07-01T10:07:36.63+00:00

    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.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.