Rename-Xbox.ps1

function Rename-Xbox
{
    <#
    .Synopsis
        Renames a single xbox console
    .Description
        Renames a single xbox console
    .Example
        Rename-xbox xPowerShell xPowerShell2
    #>

    param(
    [string]
    $Console,
    
    [String]
    $NewName
    )
    
    process {
        if ($Console) {
            $xbox = Get-Xbox | 
                Select-Object -First 1 
        } else {
            $xbox = Connect-Xbox -Console $Console
        }
        $oldName = $xbox.Name
        $xbox.Name = $NewName
        Restart-Xbox
        New-Object PSObject -Property @{
            OldName = $oldName
            NewName = $NewName
        }
    }
}