Private/New-FSLogixVHD.ps1

function New-FSLogixVHD {
    [Diagnostics.CodeAnalysis.SuppressMessageAttribute(
        <#Category#>'PSUseShouldProcessForStateChangingFunctions',
        <#CheckId#>'', Scope='Function',
        Justification = 'Not needed for a private cmdlet'
    )]
    [CmdletBinding()]
    param (
        $Target,$Size,$SectorSizeBytes
    )

    Write-Output "Creating, formatting, and mounting VHD."
    Write-Log -Message "Creating, formatting, and mounting VHD." -LogPath $LogPath
    $Size = ($Size * 1GB)
    New-VHD -path $Target -SizeBytes $Size -Dynamic -LogicalSectorSizeBytes $SectorSizeBytes |
    Mount-VHD -Passthru |  `
    get-disk -number {$_.DiskNumber} | `
    Initialize-Disk -PartitionStyle GPT -PassThru | `
    New-Partition -UseMaximumSize -AssignDriveLetter:$False | `
    Format-Volume -Confirm:$false -FileSystem NTFS -NewFileSystemLabel "Profile-$($Username)" -force | `
    get-partition | `
    Add-PartitionAccessPath -AssignDriveLetter -PassThru | `
    Dismount-VHD $Target -ErrorAction SilentlyContinue
}