Merge branch 'main' of github.com:fleschutz/PowerShell

This commit is contained in:
Markus Fleschutz 2024-10-23 15:49:51 +02:00
commit 7eb4972f99
3 changed files with 6 additions and 6 deletions

View File

@ -5,7 +5,7 @@
This PowerShell script measures the DNS resolution speed using 100 internet domains and prints it. This PowerShell script measures the DNS resolution speed using 100 internet domains and prints it.
.EXAMPLE .EXAMPLE
PS> ./check-dns.ps1 PS> ./check-dns.ps1
Internet DNS resolves 56.5 domains/sec Internet DNS queries take 33.6ms
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -25,9 +25,9 @@ try {
[float]$elapsed = $stopWatch.Elapsed.TotalSeconds * 1000.0 [float]$elapsed = $stopWatch.Elapsed.TotalSeconds * 1000.0
$speed = [math]::round($elapsed / $table.Length, 1) $speed = [math]::round($elapsed / $table.Length, 1)
if ($speed -gt 100.0) { if ($speed -gt 100.0) {
Write-Host "⚠️ Internet DNS query time $($speed)ms only" Write-Host "⚠️ Internet DNS queries are $($speed)ms slow"
} else { } else {
Write-Host "✅ Internet DNS query time $($speed)ms" Write-Host "✅ Internet DNS queries take $($speed)ms"
} }
exit 0 # success exit 0 # success
} catch { } catch {

View File

@ -29,7 +29,7 @@ try {
} elseif ($percent -ge 95) { } elseif ($percent -ge 95) {
$reply = "✅ Battery nearly full ($percent%, power scheme is '$powerScheme')" $reply = "✅ Battery nearly full ($percent%, power scheme is '$powerScheme')"
} else { } else {
$reply = "✅ Battery charging ($percent%, power scheme is '$powerScheme')" $reply = "✅ Battery $percent% and charging (power scheme is '$powerScheme')"
} }
} else { # must be offline } else { # must be offline
if (($remaining -eq 0) -and ($percent -ge 60)) { if (($remaining -eq 0) -and ($percent -ge 60)) {

View File

@ -5,7 +5,7 @@
This PowerShell script lists all network shares (aka "shared folders") of the local computer. This PowerShell script lists all network shares (aka "shared folders") of the local computer.
.EXAMPLE .EXAMPLE
PS> ./list-network-shares.ps1 PS> ./list-network-shares.ps1
Network share \\LAPTOP\Public mapped to: 📂D:\Public ("Public folder for file transfer") Network share \\LAPTOP\Public ("Public folder for file transfer") mapped to: 📂D:\Public
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -18,7 +18,7 @@ try {
} else { } else {
$shares = Get-WmiObject win32_share | where {$_.name -NotLike "*$"} $shares = Get-WmiObject win32_share | where {$_.name -NotLike "*$"}
foreach ($share in $shares) { foreach ($share in $shares) {
Write-Output "✅ Network share \\$(hostname)\$($share.Name) mapped to: 📂$($share.Path) (`"$($share.Description)`")" Write-Output "✅ Network share \\$(hostname)\$($share.Name) (`"$($share.Description)`") mapped to: 📂$($share.Path)"
} }
} }
exit 0 # success exit 0 # success