mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-18 02:30:52 +01:00
Updated some scripts
This commit is contained in:
parent
5a6fb1d698
commit
5d4df61edc
@ -15,8 +15,7 @@
|
|||||||
Author: Markus Fleschutz | License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
" "
|
Write-Host "`n H A R D W A R E" -foregroundColor green
|
||||||
& "$PSScriptRoot/write-green.ps1" " H A R D W A R E"
|
|
||||||
& "$PSScriptRoot/check-cpu.ps1"
|
& "$PSScriptRoot/check-cpu.ps1"
|
||||||
& "$PSScriptRoot/check-ram.ps1"
|
& "$PSScriptRoot/check-ram.ps1"
|
||||||
& "$PSScriptRoot/check-gpu.ps1"
|
& "$PSScriptRoot/check-gpu.ps1"
|
||||||
|
@ -15,8 +15,7 @@
|
|||||||
Author: Markus Fleschutz | License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
" "
|
Write-Host "`n N E T W O R K" -foregroundColor green
|
||||||
& "$PSScriptRoot/write-green.ps1" " N E T W O R K"
|
|
||||||
& "$PSScriptRoot/ping-remote-hosts.ps1"
|
& "$PSScriptRoot/ping-remote-hosts.ps1"
|
||||||
& "$PSScriptRoot/check-firewall"
|
& "$PSScriptRoot/check-firewall"
|
||||||
& "$PSScriptRoot/check-dns.ps1"
|
& "$PSScriptRoot/check-dns.ps1"
|
||||||
|
@ -15,8 +15,7 @@
|
|||||||
Author: Markus Fleschutz | License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
" "
|
Write-Host "`n S O F T W A R E" -foregroundColor green
|
||||||
& "$PSScriptRoot/write-green.ps1" " S O F T W A R E"
|
|
||||||
& "$PSScriptRoot/check-os.ps1"
|
& "$PSScriptRoot/check-os.ps1"
|
||||||
& "$PSScriptRoot/check-uptime.ps1"
|
& "$PSScriptRoot/check-uptime.ps1"
|
||||||
& "$PSScriptRoot/check-apps.ps1"
|
& "$PSScriptRoot/check-apps.ps1"
|
||||||
|
@ -17,9 +17,9 @@ try {
|
|||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
# TODO
|
# TODO
|
||||||
} else {
|
} else {
|
||||||
$Connections = Get-VPNConnection
|
$connections = Get-VPNConnection
|
||||||
foreach($Connection in $Connections) {
|
foreach($connection in $connections) {
|
||||||
Write-Host "✅ VPN to $($Connection.Name) is $($Connection.ConnectionStatus.ToLower())"
|
Write-Host "✅ VPN to $($connection.Name) is $($connection.ConnectionStatus.ToLower())"
|
||||||
$noVPN = $false
|
$noVPN = $false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,19 +12,20 @@
|
|||||||
Author: Markus Fleschutz | License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
$names = @('accesspoint','AD','AP','amnesiac','archlinux','auriga','berlin','boston','brother','canon','castor','cisco','echodot','epson','epson2550','epson2815','fedora','fireball','firewall','fritz.box','fritz!repeater','gassensor','gateway','hippo','heizung','hodor','homemanager','io','iphone','jarvis','jenkins','LA','laptop','linux','jupiter','mars','mercury','miami','mobile','none','none-1','none-2','NY','octo','office','officepc','paris','PI','pixel-6a','PC','pluto','printer','proxy','R2D2','raspberry','rocket','rome','router','sentinel','server','shelly','shelly1','smartphone','smartwatch','soundbar','sunnyboy','surface','switch','tablet','tau','tigercat','tolino','TV','ubuntu','vega','venus','xrx','zeus') # sorted alphabetically
|
param([int]$timeout = 600) # ms ping timeout
|
||||||
[int]$timeout = 600 # ms ping timeout
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Write-Progress "Sending pings to the local hosts..."
|
Write-Progress "Sending pings to the local hosts..."
|
||||||
|
|
||||||
|
$names = @('accesspoint','AD','AP','amnesiac','archlinux','auriga','berlin','boston','brother','canon','castor','cisco','echodot','epson','epson2550','epson2815','fedora','fireball','firewall','fritz.box','fritz!repeater','gassensor','gateway','hippo','heizung','hodor','homemanager','io','iphone','jarvis','jenkins','LA','laptop','linux','jupiter','mars','mercury','miami','mobile','none','none-1','none-2','NY','octo','office','officepc','paris','PI','pixel-6a','PC','pluto','printer','proxy','R2D2','raspberry','rocket','rome','router','sentinel','server','shelly','shelly1','smartphone','smartwatch','soundbar','sunnyboy','surface','switch','tablet','tau','tigercat','tolino','TV','ubuntu','vega','venus','xrx','zeus') # sorted alphabetically
|
||||||
$queue = [System.Collections.Queue]::new()
|
$queue = [System.Collections.Queue]::new()
|
||||||
foreach($name in $names) {
|
foreach($name in $names) {
|
||||||
$ping = [System.Net.Networkinformation.Ping]::new()
|
$ping = [System.Net.Networkinformation.Ping]::new()
|
||||||
$queue.Enqueue( @{Host=$name; Ping=$ping; Async=$ping.SendPingAsync($name, $timeout)} )
|
$queue.Enqueue( @{Host=$name; Ping=$ping; Async=$ping.SendPingAsync($name, $timeout)} )
|
||||||
}
|
}
|
||||||
|
|
||||||
$up = ""
|
[string]$up = ""
|
||||||
while ($queue.Count -gt 0) { $obj = $queue.Dequeue()
|
while ($queue.Count -gt 0) { $obj = $queue.Dequeue()
|
||||||
try { if ($obj.Async.Wait($timeout)) {
|
try { if ($obj.Async.Wait($timeout)) {
|
||||||
if ($obj.Async.Result.Status -ne "TimedOut") { $up += "$($obj.Host) " }
|
if ($obj.Async.Result.Status -ne "TimedOut") { $up += "$($obj.Host) " }
|
||||||
@ -34,8 +35,8 @@ try {
|
|||||||
$queue.Enqueue($obj)
|
$queue.Enqueue($obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Progress -completed "done."
|
Write-Progress -completed "Done."
|
||||||
Write-Host "✅ Up: $($up)"
|
Write-Host "✅ Up: $up"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user