Connect-XboxDebugger.ps1
function Connect-XboxDebugger { begin { if (-not (Test-Path Variable:\XapDmConnectDebugger)) { $Script:XapDmConnectDebugger = Add-Type -Name "Xap$(Get-Random)" ' [DllImport("xbdm.dll")] static extern int DmConnectDebugger(bool connected); ', ' public static int ConnectDebugger() { return DmConnectDebugger(true); }',' public static int DisconnectDebugger() { return DmConnectDebugger(false); } ' -PassThru } } process { $result = $Script:XapDmConnectDebugger::ConnectDebugger() $resultError = ($xbdm)::DmTranslateError($Result) if ($resultError) { Write-Error $resultError } } } |