Remove-Xbox.ps1

function Remove-Xbox
{
    <#
    .Synopsis
        Removes an xbox from an xbox neighborhood
    .Description
        Removes an xbox from an xbox neighborhood
    .Example
        Remove-Xbox MyXboxOne
    #>

    [CmdletBinding(DefaultParameterSetName="Neighborhood")]
    param(
    # The name or IP of the xbox development kit
    [Parameter(ParameterSetName="Neighborhood",Position=0,Mandatory=$true,ValueFromPipeline=$true)]
    [Parameter(ParameterSetName="Group",Position=0, Mandatory=$true,ValueFromPipeline=$true)]
    [String[]]
    $Console,
    
    # The group or groups to add the console to
    [Parameter(ParameterSetName="Group", Position=1, Mandatory=$true)]
    [String[]]
    $Group)
    
    begin {
        if (-not (Test-Path Variable:\XapXboxManager)) {
            $Script:XapXboxManager = New-Object Xdevkit.XboxManagerClass
        }    
    }
    process {
        switch ($psCmdlet.ParameterSetName) {
            Neighborhood {
                foreach ($c in $console) {
                    $script:XapXboxManager.RemoveConsole($c)
                }
            } 
        }
    }
}