Set-XboxAdminPassword.ps1

function Set-XboxAdminPassword
{
    param(
    [Parameter(Mandatory=$true)]
    [Management.Automation.PSCredential]$Credential
    )
    
    $result = 
        $xbdm::DmSetAdminPassword($Credential.GetNetworkCredential().PassWord)
    if ($result -lt 0) {
        Write-Error $xbdm::DmTranslateError($result)
    }
}