Files
Intune/dump/temp-tool1.ps1

47 lines
1.6 KiB
PowerShell

<#
$Count = 0
$W = $ServerName | % { $S = $_
Write-host "Checking Server: $S"
$Count++ ;gci \\$S\c$\windows\ccmcache -ErrorAction SilentlyContinue | ? { $_.LastWriteTime -gt ((Get-Date).AddDays(-4))} | select -First 1 | select @{n="Num";e={$Count}},@{n="Server";e={$S}},Lastwritetime,Name }
$W | sort LastWritetime -Descending
write-host "Collection Name: $DeviceCollection_Name" -ForegroundColor Yellow
#>
<######################################################################
$Responding = @()
$NotResponding = @()
$DeviceCollection_ServerNames.Name | % {
If (Test-Connection $_ -Count 1 -ErrorAction SilentlyContinue ) {
Write-Host "Responding:---- $_ " -ForegroundColor Green
$Responding += $_
}#endIf
Else { $NotResponding += $_ }
}#end%
write-host "-------------------------------------------------------"
Write-host "$($Responding.count) / $($DeviceCollection_ServerNames.Name.count) -- Responding" -foregroundcolor Green
Write-host "$($NotResponding.count) / $($DeviceCollection_ServerNames.Name.count) -- NOT Responding" -foregroundcolor Red
Write-Host "Servers NOT Responding: $NotResponding " -ForegroundColor Red
$Responding | % { gwmi win32_operatingsystem -ComputerName $_ -ErrorAction SilentlyContinue | select @{n="Server";e={$_.PSComputername}},@{n="LastBootup";e={$_.Converttodatetime($_.LastBootUpTime)}}} | sort LastBootup -descending | ft -autosize
#>