Intune Initial Scripts Backup
This commit is contained in:
32
dump/WSUS_Scripts/Check-Jobs.ps1
Normal file
32
dump/WSUS_Scripts/Check-Jobs.ps1
Normal file
@@ -0,0 +1,32 @@
|
||||
$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
|
||||
|
||||
|
||||
#>
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user