internal/functions/Mount-CFXProfile.ps1

function Mount-CFXProfile {
    [CmdletBinding()]
    param (

        [Parameter(Mandatory = $true)]
        [string] $FRX ,

        [Parameter(Mandatory = $true)]
        [string] $DiskPath

    )

    # Open disk for editing using FRX
    $editDisk = & $FRX begin-edit-profile -filename $DiskPath

    if($editDisk[-1] -ne 'Operation completed successfully!' ){
        throw ($editDisk | Out-String)
    }

    $mountPointPath = $editDisk[1]
    if(-Not (Test-Path -Path $mountPointPath)){
        throw "Mount point path is invalid: $editDisk"
    }

    $mountPointCookie = $editDisk[5]
    if(-Not ($mountPointCookie -match '^(\d|\w){4}$')){
        throw "Mount point cookie is invalid: $editDisk"
    }
    Write-PSFMessage -Level Verbose -Message "Mounted VHD at $mountPointPath - Cookie $mountPointCookie"
    [PSCustomObject]@{
        Path = $mountPointPath
        Cookie = $mountPointCookie
    }
}