function Get-PCEventLog {

    param (
        [parameter(ValueFromPipeline)]
        [string]$cn
    )
    
    if(!(Test-Connection -ComputerName $cn -Count 1)){
                
                Write-Warning "$cn is unreachable"
                return
            }
    
    $day = Read-Host "Number of days back (max 10)"

    if($day -in 1..10){
        $days = (Get-Date) - (New-TimeSpan -Day $day)
    }
    else { 
        Write-Warning "Days out of range: Defaulting to 10"
        $days = (Get-Date) - (New-TimeSpan -Day 11)
        }

    $outputTitle = "$cn | System Error Logs | Last $Day Days"

    $events = @()
    $events += Get-WinEvent -ComputerName $cn -FilterHashtable @{ LogName='System'; Level=1; StartTime=$days }
    $events += Get-WinEvent -ComputerName $cn -FilterHashtable @{ LogName='System'; Level=2; StartTime=$days }
    $events += Get-WinEvent -ComputerName $cn -FilterHashtable @{ LogName='System'; Level=3; StartTime=$days }
    
    $events | Out-GridView -Title $outputTitle

    return
}
