Intune Initial Scripts Backup
This commit is contained in:
45
dump/Server-Last-Patched.ps1
Normal file
45
dump/Server-Last-Patched.ps1
Normal file
@@ -0,0 +1,45 @@
|
||||
$Location = Split-Path $MyInvocation.MyCommand.Path -Parent
|
||||
$Final_Last_Patched_Report = @()
|
||||
$Date_Today = Get-Date -UFormat %m-%d-%Y
|
||||
|
||||
$Collection_Name = "9PM - Production Patching"
|
||||
$Collection_Servers = Import-Csv "$Location\Files\$Collection_Name.csv"
|
||||
|
||||
$Collection_Servers.Name | % {
|
||||
#Write-Host "Checking: $_" -ForeGround Green
|
||||
$HF = Get-HotFix -ComputerName $_ | sort installedon -Descending | Select -First 1
|
||||
|
||||
$Obj = New-Object -TypeName PSObject
|
||||
$Obj | Add-Member -MemberType NoteProperty -Name Server -Value $_
|
||||
$Obj | Add-Member -MemberType NoteProperty -Name InstalledOn -Value $HF.InstalledOn
|
||||
$Obj | Add-Member -MemberType NoteProperty -Name LastHF -Value $HF.HotFixID
|
||||
$Obj | Add-Member -MemberType NoteProperty -Name InstalledBy -Value $HF.InstalledBy
|
||||
$Obj | Add-Member -MemberType NoteProperty -Name Description -Value $HF.Description
|
||||
$Obj
|
||||
$Final_Last_Patched_Report += $Obj
|
||||
}#end%
|
||||
|
||||
$Final_Last_Patched_Report #| Export-Csv H:\Scripts\Patching\Server-Last-Patched\Server-Last-Patched-$Date_Today.csv -NoTypeInformation
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user