mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-26 01:43:37 +01:00
Updated some check-*.ps1 scripts
This commit is contained in:
parent
3fdab43903
commit
4ada589b40
@ -13,13 +13,13 @@
|
||||
#>
|
||||
|
||||
try {
|
||||
$Path = Resolve-Path "$HOME/.ssh"
|
||||
if (-not(Test-Path "$Path" -pathType container)) {
|
||||
throw "SSH folder at 📂$Path doesn't exist (yet)"
|
||||
}
|
||||
$Path = Resolve-Path "~/.ssh"
|
||||
if (Test-Path "$Path" -pathType container) {
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
exit 0 # success
|
||||
}
|
||||
throw "User's SSH folder at 📂$Path doesn't exist (yet)"
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
|
@ -55,17 +55,19 @@ try {
|
||||
$Arch = ""
|
||||
}
|
||||
if ([System.Environment]::Is64BitOperatingSystem) { $Bits = "64-bit" } else { $Bits = "32-bit" }
|
||||
$Cores = [System.Environment]::ProcessorCount
|
||||
"$Status $Arch CPU $Bits ($Cores cores, $Temp)"
|
||||
$CPUName = "$Arch CPU $Bits"
|
||||
$DeviceID = ""
|
||||
$Speed = ""
|
||||
$Socket = ""
|
||||
} else {
|
||||
$Details = Get-WmiObject -Class Win32_Processor
|
||||
$CPUName = $Details.Name.trim()
|
||||
$Cores = [System.Environment]::ProcessorCount
|
||||
$DeviceID = $Details.DeviceID
|
||||
$Speed = "$($Details.MaxClockSpeed)MHz"
|
||||
$Socket = $Details.SocketDesignation
|
||||
"$Status $CPUName ($Cores cores, $DeviceID, $Speed, $Socket socket, $Temp)"
|
||||
$DeviceID = "$($Details.DeviceID), "
|
||||
$Speed = "$($Details.MaxClockSpeed)MHz, "
|
||||
$Socket = "$($Details.SocketDesignation) socket, "
|
||||
}
|
||||
$Cores = [System.Environment]::ProcessorCount
|
||||
Write-Host "$Status $CPUName ($Cores cores, $($DeviceID)$($Speed)$($Socket)$Temp)"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -25,8 +25,11 @@ try {
|
||||
}
|
||||
[float]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
|
||||
Write-Progress -Completed " "
|
||||
$Average = [math]::round($NumRows / $Elapsed, 1)
|
||||
if ($Average -gt 10.0) {
|
||||
if ($Average -gt 100.0) {
|
||||
"✅ DNS resolves excellent $Average domains per second"
|
||||
} elseif ($Average -gt 10.0) {
|
||||
"✅ DNS resolves $Average domains per second"
|
||||
} else {
|
||||
"⚠️ DNS resolves only $Average domains per second!"
|
||||
|
@ -36,7 +36,7 @@ try {
|
||||
$RefreshRate = $Details.CurrentRefreshRate
|
||||
$DriverVersion = $Details.DriverVersion
|
||||
$Status = $Details.Status
|
||||
"✅ $Model GPU ($(Bytes2String $RAMSize) RAM, $($ResWidth)x$($ResHeight) pixels, $BitsPerPixel bit, $RefreshRate Hz, driver $DriverVersion, status $Status)"
|
||||
Write-Host "✅ $Model GPU ($(Bytes2String $RAMSize) RAM, $($ResWidth)x$($ResHeight) pixels, $BitsPerPixel bit, $RefreshRate Hz, driver $DriverVersion, status $Status)"
|
||||
}
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -31,8 +31,10 @@
|
||||
& "$PSScriptRoot/check-uptime.ps1"
|
||||
& "$PSScriptRoot/check-time-zone.ps1"
|
||||
& "$PSScriptRoot/check-swap-space.ps1"
|
||||
& "$PSScriptRoot/check-dns.ps1"
|
||||
& "$PSScriptRoot/check-ping.ps1"
|
||||
& "$PSScriptRoot/check-vpn.ps1"
|
||||
& "$PSScriptRoot/check-pending-reboot.ps1"
|
||||
" "
|
||||
& "$PSScriptRoot/write-green.ps1" " N E T W O R K"
|
||||
& "$PSScriptRoot/check-ping.ps1"
|
||||
& "$PSScriptRoot/check-dns.ps1"
|
||||
& "$PSScriptRoot/check-vpn.ps1"
|
||||
exit 0 # success
|
@ -7,7 +7,7 @@
|
||||
Specifies the hosts to check, seperated by comma (default is: amazon.com,bing.com,cnn.com,dropbox.com,facebook.com,google.com,live.com,twitter.com,youtube.com)
|
||||
.EXAMPLE
|
||||
PS> ./check-ping
|
||||
✅ Ping is 25ms average, 13ms min, 109ms max.
|
||||
✅ Ping is 25ms average, 13ms min, 109ms max
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -17,10 +17,11 @@
|
||||
param([string]$hosts = "amazon.com,bing.com,cnn.com,dropbox.com,facebook.com,google.com,live.com,twitter.com,youtube.com")
|
||||
|
||||
try {
|
||||
Write-Progress "⏳ Pinging $hosts..."
|
||||
Write-Progress "⏳ (1/2) Pinging $hosts..."
|
||||
$HostsArray = $hosts.Split(",")
|
||||
$Pings = Test-Connection -count 1 -computerName $HostsArray
|
||||
|
||||
Write-Progress "⏳ (2/2) Calculating results..."
|
||||
[int]$Min = 9999999
|
||||
[int]$Max = [int]$Avg = 0
|
||||
foreach($Ping in $Pings) {
|
||||
@ -30,6 +31,8 @@ try {
|
||||
$Avg += $Latency
|
||||
}
|
||||
$Avg /= $Pings.count
|
||||
|
||||
Write-Progress -Completed " "
|
||||
"✅ Ping is $($Avg)ms average, $($Min)ms min, $($Max)ms max"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
|
@ -69,7 +69,7 @@ try {
|
||||
[float]$Voltage = $Bank.ConfiguredVoltage / 1000.0
|
||||
$Manufacturer = $Bank.Manufacturer
|
||||
$Location = "$($Bank.BankLabel)/$($Bank.DeviceLocator)"
|
||||
"✅ $Capacity $Type ($($Speed)MHz, $($Voltage)V) at $Location by $Manufacturer"
|
||||
Write-Host "✅ $Capacity $Type ($($Speed)MHz, $($Voltage)V) at $Location by $Manufacturer"
|
||||
}
|
||||
}
|
||||
exit 0 # success
|
||||
|
Loading…
Reference in New Issue
Block a user