Untitled

 avatar
unknown
plain_text
5 months ago
396 B
3
Indexable
Write-Host "Identifying machines that haven't checked in for $DaysSinceLastCheckIn days..." -ForegroundColor Cyan

$thresholdDate = (Get-Date).AddDays(-$DaysSinceLastCheckIn)

$inactiveComputers = $computers | Where-Object {
    ($_ .lastCheckInDateTime -eq $null) -or
    ([DateTime]$_ .lastCheckInDateTime -lt $thresholdDate)
}

Write-Host "Found $($inactiveComputers.Count) inactive machines."
Editor is loading...
Leave a Comment