Intune Initial Scripts Backup

This commit is contained in:
2025-04-21 14:21:38 -04:00
commit 71764cd10f
241 changed files with 28218 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
$Downloaded_Updates = @()
$NOT_Downloaded_Updates = @()
$Count = 0
$Servers = Import-Csv 'E:\SCCM-Files\SCCM-Scripts\Files\9PM - Production Patching-NoInstall.csv'
$Servers.Server | % {
$Computer = $_
$Check_Contents = gci "\\$Computer\c$\Windows\ccmcache" -ErrorAction SilentlyContinue #| ? { $_.lastwritetime -gt ((Get-Date).AddHours((-$Last_Writetime))) }
If ($Check_Contents) { $Downloaded_Updates += $Computer }
Else { $NOT_Downloaded_Updates += $Computer }
}
If($Downloaded_Updates) {
$Downloaded_Updates | % {
$Updates_Downloaded = gci "\\$_\c$\Windows\ccmcache" -ErrorAction SilentlyContinue #| ? { $_.lastwritetime -gt ((Get-Date).AddHours((-$Last_Writetime))) }
$Obj = New-Object -TypeName PSObject
$Obj | Add-Member -MemberType NoteProperty -Name Computer -Value $_
$Obj | Add-Member -MemberType NoteProperty -Name LastWriteTime -Value $Updates_Downloaded[-1].LastWriteTime
$Obj | Add-Member -MemberType NoteProperty -Name FileName -Value $Updates_Downloaded[-1].Name
$Obj | Add-Member -MemberType NoteProperty -Name UpdatesCount -Value ($Updates_Downloaded.count)
$Obj
}#end%
}#endIf
Write-Host ""
Write-Host "Nothing Downloaded for: $NOT_Downloaded_Updates" -ForegroundColor Yellow
Write-Host ""
Write-Host "Servers Downloaded patches count: $($Downloaded_Updates.count)" -ForegroundColor Green
Write-Host ""