Start-XboxProfiling.ps1

function Start-XboxProfiling
{
    param(
    # The path and file name where the profiling log data is written.
    # These files must use the .cap extension.
    [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
    [string]
    $FileName,
    
    # The size of the buffer in pages. Each page is 4096 kb.
    [Uint32]
    $BufferSize = 1,
    
    # The console or consoles to start profiling
    [Parameter(ValueFromPipelineByPropertyName=$true)]
    [Alias('DebugIPAddress')]
    [ValidateNotNullOrEmpty()]
    [String[]]
    $Console
    )
    
    process {
        if (-not $Console) {
            Get-Xbox | 
                Start-XboxProfiling @psBoundParameters
        }
        $result = $xbdm::DmStartProfiling($FileName, $BufferSize * 4096)
        if ($result -ne $script:XbdmSuccess) {
            Write-Error $xbdm::DmTranslateError($result)
        }
    }
}