Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Reply To: Format Partition

$
0
0

I believe the last part of this script http://gallery.technet.microsoft.com/Powershell-script-to-e4df3bae does just that.
Basically you're looking at lines 79-83 of this script:

$DriveLetter = "k"
    $BlockSize = 64KB
    #
    $VMDisks = Get-Disk | where partitionstyle -eq "Raw" # Get raw disks if any. You can change this line to pick a specific disk based on disk number for example like: Get-Disk | where Number -EQ 0
    if ($VMDisks.Count -gt 0) {
        Initialize-Disk -Number $VMDisks[0].Number -PartitionStyle GPT -PassThru 
        New-Partition -DiskNumber $VMDisks[0].Number -DriveLetter $DriveLetter -UseMaximumSize
        Format-Volume -DriveLetter $DriveLetter -FileSystem NTFS -NewFileSystemLabel "Drive_$DriveLetter" -Confirm:$false -AllocationUnitSize $BlockSize
        }

Viewing all articles
Browse latest Browse all 13067

Trending Articles