Get-XboxScreenshot.ps1

function Get-XboxScreenshot
{
    param(
    [Parameter(ValueFromPipelineByPropertyName=$true)]
    [String]$OutputFile,
    
    [Parameter(ValueFromPipelineByPropertyName=$true)]
    [Alias('DebugIPAddress')]
    [String[]]
    $Console,
    
    [Switch]
    $Bitmap    
    )
    
    process {
        $ProcessBlock = {
            $xbox = $_
            $name = $xbox.Name
            $debugIPAddress = $xbox.DebugIPAddress
            if (-not $PSBoundParameters.ContainsKey("OutputFile")) {
                $NULL = mkdir $env:UserProfile\Pictures\XboxScreenshot 2>&1
                $nowString = (Get-Date | Out-String).Trim().Replace(":", "-")
                $outputFile = "$env:UserProfile\Pictures\XboxScreenshot\$name.$nowString.bmp"
            }
            $noExtension = $outputFile.Substring(0, $outputFile.LastIndexOf("."))            
            try {
                $xbox.ScreenShot($outputFile)
                if (-not $Bitmap) {
                    $imageFile = New-Object -ComObject Wia.ImageFile
                    $imageFile.LoadFile($OutputFile)
                    $imageProcess =New-Object -ComObject Wia.ImageProcess
                    $process = New-Object -ComObject Wia.ImageProcess
                    $convertFilter = $process.FilterInfos.Item("Convert").FilterId
                    $process.Filters.Add($convertFilter)
                    $process.Filters.Item(1).Properties.Item("Quality") = 100
                    $process.Filters.Item(1).Properties.Item("FormatID") = "{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}"
                    $newImg = $process.Apply($imageFile.PSObject.BaseObject)
                    $newImg.SaveFile("$noExtension.jpg")   
                    $null  = Remove-Item $OutputFile -Force
                    $outputFile = "$noExtension.jpg"                                                       
                }
                New-Object PSObject -Property @{
                    Console = $Name
                    DebugIDAddress = $debugIPAddress 
                    Screenshot = Get-Item $outputFile
                }                         
            }
            catch {
                Write-Error $_
            }
        }
        if (-not $Console) {
            Get-Xbox | ForEach-Object $ProcessBlock
        } else {
            $Console | 
                Connect-Xbox |
                ForEach-Object $ProcessBlock
        }
    }
}