$Check_Jobs = Import-Csv "E:\WSUS_Scripts\Patching-Day\December-2019\Tier2B-December-Patching\ReRun\Tier2B-FAILED-Jobs-22-01-PM.csv" | select @{n="Server";e={$_.Name.split('#')[1]}},State,PSBeginTime

##$Completed_Jobs = $Check_Jobs | ? { $_.State -eq "Completed" }
##$Failed_Jobs = $Check_Jobs | ? { $_.State -eq "Failed" }
#$P_Job_Servers = @()

##### Reboot Completed Ones and Run patching again  #####
#Restart-Computer $Completed_Jobs.Server -Force -Verbose


Foreach ($S in $Completed_Jobs.Server) {     
    #$S = $T.name
    #$P_Job_Servers += Start-Job -ScriptBlock { Param($S) WindowsUpdate\Install-WindowsUpdate -ComputerName $S } -Name "$WSUSGroup-#$S#-Patching" -ArgumentList $S  
     
}#endForeach

<#

$Tier2B_Servers."Server Name" | % { $T = Test-Connection -ComputerName $_ -Count 1 -ErrorAction SilentlyContinue 
                                        If($T) { Write-Host  "Server $_ -- Responding" -ForegroundColor Green } Else { Write-Host "Server $_ -- Not Responding" -ForegroundColor Red } 
}

#######################################################################################################

$Tier2B_Servers."Server Name" | % { gwmi win32_operatingsystem -ComputerName $_ | select  @{n="Server";e={$_.PSComputername}},@{n="LastBootup";e={$_.Converttodatetime($_.LastBootUpTime)}}} | ft -autosize


#>




