Update the manuals

This commit is contained in:
Markus Fleschutz 2023-09-01 17:53:03 +02:00
parent 6aeb2895f2
commit 151cbd90cd
577 changed files with 2612 additions and 1003 deletions

View File

@ -318,7 +318,7 @@ start-calibre-server.ps1, Starts a local Calibre server,
start-ipfs-server.ps1, Starts a local IPFS server, start-ipfs-server.ps1, Starts a local IPFS server,
switch-branch.ps1, Switches the branch in the current/given Git repository (including submodules), switch-branch.ps1, Switches the branch in the current/given Git repository (including submodules),
switch-shelly1.ps1, Switches a Shelly1 device in the local network, switch-shelly1.ps1, Switches a Shelly1 device in the local network,
sync-repo.ps1, Synchronizes a Git repository by push & pull (including submodules), sync-repo.ps1, Synchronizes a Git repository by pull & push (including submodules),
tell-joke.ps1,Tells a random joke by text-to-speech, tell-joke.ps1,Tells a random joke by text-to-speech,
tell-quote.ps1,Tells a random quote by text-to-speech, tell-quote.ps1,Tells a random quote by text-to-speech,
toggle-caps-lock.ps1,Toggle Caps Lock, toggle-caps-lock.ps1,Toggle Caps Lock,

1 SCRIPT DESCRIPTION
318 start-ipfs-server.ps1 Starts a local IPFS server
319 switch-branch.ps1 Switches the branch in the current/given Git repository (including submodules)
320 switch-shelly1.ps1 Switches a Shelly1 device in the local network
321 sync-repo.ps1 Synchronizes a Git repository by push & pull (including submodules) Synchronizes a Git repository by pull & push (including submodules)
322 tell-joke.ps1 Tells a random joke by text-to-speech
323 tell-quote.ps1 Tells a random quote by text-to-speech
324 toggle-caps-lock.ps1 Toggle Caps Lock

View File

@ -109,4 +109,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of add-firewall-rules.ps1 as of 08/06/2023 21:36:04)* *(generated by convert-ps2md.ps1 using the comment-based help of add-firewall-rules.ps1 as of 09/01/2023 17:51:47)*

View File

@ -79,4 +79,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of add-memo.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of add-memo.ps1 as of 09/01/2023 17:51:47)*

View File

@ -71,4 +71,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of alert.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of alert.ps1 as of 09/01/2023 17:51:47)*

View File

@ -177,4 +177,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of build-repo.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of build-repo.ps1 as of 09/01/2023 17:51:47)*

View File

@ -82,4 +82,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of build-repos.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of build-repos.ps1 as of 09/01/2023 17:51:47)*

View File

@ -60,4 +60,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-autostart.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-autostart.ps1 as of 09/01/2023 17:51:47)*

View File

@ -60,4 +60,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-crashdumps.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-crashdumps.ps1 as of 09/01/2023 17:51:47)*

View File

@ -64,4 +64,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-desktop.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-desktop.ps1 as of 09/01/2023 17:51:47)*

View File

@ -64,4 +64,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-docs.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-docs.ps1 as of 09/01/2023 17:51:47)*

View File

@ -64,4 +64,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-downloads.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-downloads.ps1 as of 09/01/2023 17:51:47)*

View File

@ -60,4 +60,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-dropbox.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-dropbox.ps1 as of 09/01/2023 17:51:47)*

View File

@ -64,4 +64,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-etc.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-etc.ps1 as of 09/01/2023 17:51:47)*

View File

@ -60,4 +60,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-fonts.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-fonts.ps1 as of 09/01/2023 17:51:47)*

View File

@ -60,4 +60,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-home.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-home.ps1 as of 09/01/2023 17:51:47)*

View File

@ -48,4 +48,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-logs.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-logs.ps1 as of 09/01/2023 17:51:47)*

View File

@ -64,4 +64,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-music.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-music.ps1 as of 09/01/2023 17:51:47)*

View File

@ -60,4 +60,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-onedrive.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-onedrive.ps1 as of 09/01/2023 17:51:48)*

View File

@ -62,4 +62,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-pics.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-pics.ps1 as of 09/01/2023 17:51:48)*

View File

@ -62,4 +62,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-public.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-public.ps1 as of 09/01/2023 17:51:48)*

View File

@ -53,4 +53,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-recycle-bin.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-recycle-bin.ps1 as of 09/01/2023 17:51:48)*

View File

@ -80,4 +80,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-repos.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-repos.ps1 as of 09/01/2023 17:51:48)*

View File

@ -57,4 +57,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-root.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-root.ps1 as of 09/01/2023 17:51:48)*

View File

@ -55,4 +55,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-screenshots.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-screenshots.ps1 as of 09/01/2023 17:51:48)*

View File

@ -58,4 +58,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-scripts.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-scripts.ps1 as of 09/01/2023 17:51:48)*

View File

@ -58,4 +58,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-ssh.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-ssh.ps1 as of 09/01/2023 17:51:48)*

View File

@ -50,4 +50,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-temp.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-temp.ps1 as of 09/01/2023 17:51:48)*

View File

@ -62,4 +62,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-templates.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-templates.ps1 as of 09/01/2023 17:51:48)*

View File

@ -53,4 +53,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-trash.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-trash.ps1 as of 09/01/2023 17:51:48)*

View File

@ -58,4 +58,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-up.ps1 as of 09/01/2023 17:51:48)*

View File

@ -58,4 +58,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up2.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-up2.ps1 as of 09/01/2023 17:51:48)*

View File

@ -58,4 +58,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up3.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-up3.ps1 as of 09/01/2023 17:51:48)*

View File

@ -58,4 +58,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up4.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-up4.ps1 as of 09/01/2023 17:51:48)*

View File

@ -58,4 +58,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-users.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-users.ps1 as of 09/01/2023 17:51:48)*

View File

@ -62,4 +62,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-videos.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-videos.ps1 as of 09/01/2023 17:51:48)*

View File

@ -58,4 +58,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-windows.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-windows.ps1 as of 09/01/2023 17:51:48)*

View File

@ -79,4 +79,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of change-wallpaper.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of change-wallpaper.ps1 as of 09/01/2023 17:51:48)*

View File

@ -1,7 +1,7 @@
*check-apps.ps1* *check-apps.ps1*
================ ================
This PowerShell script queries the application status and prints it. This PowerShell script queries the installed applications and prints it.
Parameters Parameters
---------- ----------
@ -17,7 +17,7 @@ Example
------- -------
```powershell ```powershell
PS> ./check-apps.ps1 PS> ./check-apps.ps1
✅ 119 apps installed, 11 upgrades available ✅ 119 Windows apps installed, 11 upgrades available
``` ```
@ -36,10 +36,10 @@ Script Content
.SYNOPSIS .SYNOPSIS
Query the app status Query the app status
.DESCRIPTION .DESCRIPTION
This PowerShell script queries the application status and prints it. This PowerShell script queries the installed applications and prints it.
.EXAMPLE .EXAMPLE
PS> ./check-apps.ps1 PS> ./check-apps.ps1
✅ 119 apps installed, 11 upgrades available ✅ 119 Windows apps installed, 11 upgrades available
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -48,12 +48,16 @@ Script Content
try { try {
if ($IsLinux) { if ($IsLinux) {
$NumSnaps = (snap list).Count - 1 Write-Progress "⏳ Querying installed applications..."
Write-Host "✅ $($NumSnaps) snaps installed" $numPkgs = (apt list --installed 2>/dev/null).Count
$numSnaps = (snap list).Count - 1
Write-Progress -Completed "."
Write-Host "✅ $numPkgs Debian packages, $numSnaps snaps installed"
} else { } else {
Write-Progress "⏳ Querying installed apps and updates..." Write-Progress "⏳ Querying installed applications..."
$Apps = Get-AppxPackage $Apps = Get-AppxPackage
$Status = "✅ $($Apps.Count) apps installed" Write-Progress -Completed "."
Write-Host "✅ $($Apps.Count) Windows apps installed, " -noNewline
[int]$NumNonOk = 0 [int]$NumNonOk = 0
foreach($App in $Apps) { if ($App.Status -ne "Ok") { $NumNonOk++ } } foreach($App in $Apps) { if ($App.Status -ne "Ok") { $NumNonOk++ } }
@ -62,8 +66,7 @@ try {
if ($NumErrors -gt 0) { $Status += ", $NumErrors errors" } if ($NumErrors -gt 0) { $Status += ", $NumErrors errors" }
$NumUpdates = (winget upgrade --include-unknown).Count - 5 $NumUpdates = (winget upgrade --include-unknown).Count - 5
Write-Progress -Completed "." Write-Host "$NumUpdates upgrades available"
Write-Host "$Status, $NumUpdates upgrades available"
} }
exit 0 # success exit 0 # success
} catch { } catch {
@ -72,4 +75,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-apps.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of check-apps.ps1 as of 09/01/2023 17:51:48)*

View File

@ -17,7 +17,7 @@ Example
------- -------
```powershell ```powershell
PS> ./check-bios.ps1 PS> ./check-bios.ps1
✅ BIOS model F6 version ALASKA - 1072009 by American Megatrends Inc. ✅ BIOS model P62 v02.67 by HP (version HPQOEM - 5, S/N CZC1080B01)
``` ```
@ -39,7 +39,7 @@ Script Content
This PowerShell script queries the BIOS status and prints it. This PowerShell script queries the BIOS status and prints it.
.EXAMPLE .EXAMPLE
PS> ./check-bios.ps1 PS> ./check-bios.ps1
✅ BIOS model F6 version ALASKA - 1072009 by American Megatrends Inc. ✅ BIOS model P62 v02.67 by HP (version HPQOEM - 5, S/N CZC1080B01)
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -49,24 +49,24 @@ Script Content
try { try {
if ($IsLinux) { if ($IsLinux) {
Write-Progress "⏳ Querying BIOS details..." Write-Progress "⏳ Querying BIOS details..."
$Model = (sudo dmidecode -s system-product-name) $model = (sudo dmidecode -s system-product-name)
if ("$Model" -ne "") { if ("$model" -ne "") {
$Version = (sudo dmidecode -s bios-version) $version = (sudo dmidecode -s bios-version)
$RelDate = (sudo dmidecode -s bios-release-date) $releaseDate = (sudo dmidecode -s bios-release-date)
$Manufacturer = (sudo dmidecode -s system-manufacturer) $manufacturer = (sudo dmidecode -s system-manufacturer)
Write-Host "✅ BIOS model $Model version $Version of $RelDate by $Manufacturer" Write-Host "✅ BIOS model $model by $manufacturer (version $version of $releaseDate)"
} }
Write-Progress -completed "." Write-Progress -completed "."
} else { } else {
$BIOS = Get-CimInstance -ClassName Win32_BIOS $BIOS = Get-CimInstance -ClassName Win32_BIOS
$Model = $BIOS.Name.Trim() $model = $BIOS.Name.Trim()
$Version = $BIOS.Version.Trim() $version = $BIOS.Version.Trim()
$Serial = $BIOS.SerialNumber.Trim() $serialNumber = $BIOS.SerialNumber.Trim()
$Manufacturer = $BIOS.Manufacturer.Trim() $manufacturer = $BIOS.Manufacturer.Trim()
if ($Serial -eq "To be filled by O.E.M.") { if ($serialNumber -eq "To be filled by O.E.M.") {
Write-Host "✅ BIOS model $Model version $Version by $Manufacturer" Write-Host "✅ BIOS model $model by $manufacturer (version $version)"
} else { } else {
Write-Host "✅ BIOS model $Model version $Version, S/N $Serial, by $Manufacturer" Write-Host "✅ BIOS model $model by $manufacturer (version $version, S/N $serialNumber)"
} }
} }
exit 0 # success exit 0 # success
@ -76,4 +76,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-bios.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of check-bios.ps1 as of 09/01/2023 17:51:48)*

View File

@ -103,4 +103,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-cpu.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of check-cpu.ps1 as of 09/01/2023 17:51:48)*

View File

@ -57,4 +57,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-day.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of check-day.ps1 as of 09/01/2023 17:51:48)*

View File

@ -72,4 +72,4 @@ foreach($row in $table){$nop=Resolve-DNSName $row.Domain}
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-dns.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of check-dns.ps1 as of 09/01/2023 17:51:48)*

View File

@ -91,4 +91,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-drive-space.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of check-drive-space.ps1 as of 09/01/2023 17:51:48)*

View File

@ -1,14 +1,14 @@
*check-drives.ps1* *check-drives.ps1*
================ ================
This PowerShell script checks all drives for free space left. This PowerShell script queries the free space of all drives and prints it.
Parameters Parameters
---------- ----------
```powershell ```powershell
PS> ./check-drives.ps1 [[-MinLevel] <Int32>] [<CommonParameters>] PS> ./check-drives.ps1 [[-minLevel] <Int64>] [<CommonParameters>]
-MinLevel <Int32> -minLevel <Int64>
Specifies the minimum warning level (10 GB by default) Specifies the minimum warning level (10 GB by default)
Required? false Required? false
@ -26,7 +26,8 @@ Example
------- -------
```powershell ```powershell
PS> ./check-drives.ps1 PS> ./check-drives.ps1
✅ Drive C: with 250GB at 10%, 225GB free ✅ Drive C: uses 49% of 1TB, 512GB free
✅ Drive D: uses 84% of 4TB, 641GB free
``` ```
@ -45,60 +46,56 @@ Script Content
.SYNOPSIS .SYNOPSIS
Checks the drive space Checks the drive space
.DESCRIPTION .DESCRIPTION
This PowerShell script checks all drives for free space left. This PowerShell script queries the free space of all drives and prints it.
.PARAMETER MinLevel .PARAMETER minLevel
Specifies the minimum warning level (10 GB by default) Specifies the minimum warning level (10 GB by default)
.EXAMPLE .EXAMPLE
PS> ./check-drives.ps1 PS> ./check-drives.ps1
✅ Drive C: with 250GB at 10%, 225GB free ✅ Drive C: uses 49% of 1TB, 512GB free
✅ Drive D: uses 84% of 4TB, 641GB free
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
param([int]$MinLevel = 10) # 10 GB minimum param([int64]$minLevel = 10) # 10 GB minimum
function Bytes2String { param([int64]$Bytes) function Bytes2String { param([int64]$bytes)
if ($Bytes -lt 1000) { return "$Bytes bytes" } if ($bytes -lt 1000) { return "$bytes bytes" }
$Bytes /= 1000 $bytes /= 1000
if ($Bytes -lt 1000) { return "$($Bytes)KB" } if ($bytes -lt 1000) { return "$($bytes)KB" }
$Bytes /= 1000 $bytes /= 1000
if ($Bytes -lt 1000) { return "$($Bytes)MB" } if ($bytes -lt 1000) { return "$($bytes)MB" }
$Bytes /= 1000 $bytes /= 1000
if ($Bytes -lt 1000) { return "$($Bytes)GB" } if ($bytes -lt 1000) { return "$($bytes)GB" }
$Bytes /= 1000 $bytes /= 1000
if ($Bytes -lt 1000) { return "$($Bytes)TB" } if ($bytes -lt 1000) { return "$($bytes)TB" }
$Bytes /= 1000 $bytes /= 1000
if ($Bytes -lt 1000) { return "$($Bytes)PB" } return "$($bytes)PB"
$Bytes /= 1000
if ($Bytes -lt 1000) { return "$($Bytes)EB" }
} }
try { try {
Write-Progress "⏳ Querying drives..." Write-Progress "⏳ Querying drives..."
$Drives = Get-PSDrive -PSProvider FileSystem $drives = Get-PSDrive -PSProvider FileSystem
$minLevel *= 1000 * 1000 * 1000
Write-Progress -completed "." Write-Progress -completed "."
foreach($Drive in $Drives) { foreach($drive in $drives) {
$Details = (Get-PSDrive $Drive.Name) $details = (Get-PSDrive $drive.Name)
if ($IsLinux) { $ID = $Drive.Name } else { $ID = $Drive.Name + ":" } if ($IsLinux) { $name = $drive.Name } else { $name = $drive.Name + ":" }
[int64]$Free = $Details.Free [int64]$free = $details.Free
[int64]$Used = $Details.Used [int64]$used = $details.Used
[int64]$Total = ($Used + $Free) [int64]$total = ($used + $free)
if ($Total -eq 0) { if ($total -eq 0) {
Write-Host "✅ Drive $ID is empty" Write-Host "✅ Drive $name is empty"
} elseif ($Free -eq 0) { } elseif ($free -eq 0) {
Write-Host "⚠️ Drive $ID with $(Bytes2String $Total) is 100% full" Write-Host "⚠️ Drive $name with $(Bytes2String $total) is full"
} elseif ($Free -lt $MinLevel) { } elseif ($free -lt $minLevel) {
Write-Host "⚠️ Drive $ID with $(Bytes2String $Total) is nearly full, $(Bytes2String $Free) free" Write-Host "⚠️ Drive $name with $(Bytes2String $total) is nearly full, $(Bytes2String $free) free"
} else { } else {
[int]$Percent = ($Used * 100) / $Total [int]$percent = ($used * 100) / $total
if ($Percent -gt 90) { Write-Host "✅ Drive $name uses $percent% of $(Bytes2String $total), $(Bytes2String $free) free"
Write-Host "✅ Drive $ID with $(Bytes2String $Total) is $Percent% full, $(Bytes2String $Free) free"
} else {
Write-Host "✅ Drive $ID with $(Bytes2String $Total) at $Percent%, $(Bytes2String $Free) free"
}
} }
} }
exit 0 # success exit 0 # success
@ -108,4 +105,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-drives.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of check-drives.ps1 as of 09/01/2023 17:51:48)*

View File

@ -63,4 +63,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-dusk.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of check-dusk.ps1 as of 09/01/2023 17:51:48)*

View File

@ -61,4 +61,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-easter-sunday.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of check-easter-sunday.ps1 as of 09/01/2023 17:51:48)*

View File

@ -75,4 +75,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-file-system.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of check-file-system.ps1 as of 09/01/2023 17:51:48)*

View File

@ -170,4 +170,4 @@ function Check-Header { param( $path )
Check-Header $Path Check-Header $Path
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-file.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of check-file.ps1 as of 09/01/2023 17:51:48)*

View File

@ -65,4 +65,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-firewall.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of check-firewall.ps1 as of 09/01/2023 17:51:48)*

View File

@ -65,4 +65,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-gpu.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of check-gpu.ps1 as of 09/01/2023 17:51:48)*

View File

@ -59,8 +59,8 @@ Script Content
& "$PSScriptRoot/check-gpu.ps1" & "$PSScriptRoot/check-gpu.ps1"
& "$PSScriptRoot/check-smart-devices.ps1" & "$PSScriptRoot/check-smart-devices.ps1"
& "$PSScriptRoot/check-drives.ps1" & "$PSScriptRoot/check-drives.ps1"
& "$PSScriptRoot/check-battery.ps1" & "$PSScriptRoot/check-power.ps1"
exit 0 # success exit 0 # success
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-hardware.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of check-hardware.ps1 as of 09/01/2023 17:51:48)*

View File

@ -58,4 +58,4 @@ Script Content
exit 0 # success exit 0 # success
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-health.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of check-health.ps1 as of 09/01/2023 17:51:48)*

View File

@ -61,4 +61,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-independence-day.ps1 as of 08/06/2023 21:36:05)* *(generated by convert-ps2md.ps1 using the comment-based help of check-independence-day.ps1 as of 09/01/2023 17:51:48)*

View File

@ -84,4 +84,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-ipv4-address.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-ipv4-address.ps1 as of 09/01/2023 17:51:48)*

View File

@ -98,4 +98,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-ipv6-address.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-ipv6-address.ps1 as of 09/01/2023 17:51:48)*

View File

@ -55,4 +55,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-iss-position.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-iss-position.ps1 as of 09/01/2023 17:51:48)*

View File

@ -87,4 +87,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-mac-address.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-mac-address.ps1 as of 09/01/2023 17:51:48)*

View File

@ -60,4 +60,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-midnight.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-midnight.ps1 as of 09/01/2023 17:51:48)*

View File

@ -57,4 +57,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-month.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-month.ps1 as of 09/01/2023 17:51:48)*

View File

@ -76,4 +76,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-moon-phase.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-moon-phase.ps1 as of 09/01/2023 17:51:48)*

View File

@ -60,8 +60,8 @@ Script Content
& "$PSScriptRoot/check-ping.ps1" & "$PSScriptRoot/check-ping.ps1"
& "$PSScriptRoot/check-dns.ps1" & "$PSScriptRoot/check-dns.ps1"
& "$PSScriptRoot/check-vpn.ps1" & "$PSScriptRoot/check-vpn.ps1"
& "$PSScriptRoot/check-ip.ps1" & "$PSScriptRoot/list-public-ip.ps1"
exit 0 # success exit 0 # success
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-network.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-network.ps1 as of 09/01/2023 17:51:48)*

View File

@ -60,4 +60,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-new-year.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-new-year.ps1 as of 09/01/2023 17:51:48)*

View File

@ -59,4 +59,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-noon.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-noon.ps1 as of 09/01/2023 17:51:48)*

View File

@ -73,4 +73,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-os.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-os.ps1 as of 09/01/2023 17:51:48)*

View File

@ -65,4 +65,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-outlook.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-outlook.ps1 as of 09/01/2023 17:51:48)*

View File

@ -94,4 +94,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-password.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-password.ps1 as of 09/01/2023 17:51:49)*

View File

@ -92,4 +92,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-pending-reboot.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-pending-reboot.ps1 as of 09/01/2023 17:51:49)*

View File

@ -1,7 +1,7 @@
*check-ping.ps1* *check-ping.ps1*
================ ================
This PowerShell script measures the ping roundtrip times from the local computer to 10 Internet servers. This PowerShell script measures the ping roundtrip times from the local computer to other computers (10 Internet servers by default).
Parameters Parameters
---------- ----------
@ -9,11 +9,11 @@ Parameters
PS> ./check-ping.ps1 [[-hosts] <String>] [<CommonParameters>] PS> ./check-ping.ps1 [[-hosts] <String>] [<CommonParameters>]
-hosts <String> -hosts <String>
Specifies the hosts to check, seperated by commata (default is: amazon.com,bing.com,cnn.com,dropbox.com,facebook.com,github.com,google.com,live.com,twitter.com,youtube.com) Specifies the hosts to check, seperated by commata (default is: amazon.com,bing.com,cnn.com,dropbox.com,github.com,google.com,live.com,meta.com,x.com,youtube.com)
Required? false Required? false
Position? 1 Position? 1
Default value amazon.com,bing.com,cnn.com,dropbox.com,facebook.com,github.com,google.com,live.com,twitter.com,youtube.com Default value bing.com,cnn.com,dropbox.com,github.com,google.com,ibm.com,live.com,meta.com,x.com,youtube.com
Accept pipeline input? false Accept pipeline input? false
Accept wildcard characters? false Accept wildcard characters? false
@ -26,7 +26,7 @@ Example
------- -------
```powershell ```powershell
PS> ./check-ping.ps1 PS> ./check-ping.ps1
✅ Ping latency is 29ms average (13ms...109ms, 0 loss) ✅ Ping latency is 29ms average (13ms...109ms, 0/10 loss)
``` ```
@ -45,42 +45,46 @@ Script Content
.SYNOPSIS .SYNOPSIS
Checks the ping latency Checks the ping latency
.DESCRIPTION .DESCRIPTION
This PowerShell script measures the ping roundtrip times from the local computer to 10 Internet servers. This PowerShell script measures the ping roundtrip times from the local computer to other computers (10 Internet servers by default).
.PARAMETER hosts .PARAMETER hosts
Specifies the hosts to check, seperated by commata (default is: amazon.com,bing.com,cnn.com,dropbox.com,facebook.com,github.com,google.com,live.com,twitter.com,youtube.com) Specifies the hosts to check, seperated by commata (default is: amazon.com,bing.com,cnn.com,dropbox.com,github.com,google.com,live.com,meta.com,x.com,youtube.com)
.EXAMPLE .EXAMPLE
PS> ./check-ping.ps1 PS> ./check-ping.ps1
✅ Ping latency is 29ms average (13ms...109ms, 0 loss) ✅ Ping latency is 29ms average (13ms...109ms, 0/10 loss)
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
param([string]$hosts = "amazon.com,bing.com,cnn.com,dropbox.com,facebook.com,github.com,google.com,live.com,twitter.com,youtube.com") param([string]$hosts = "bing.com,cnn.com,dropbox.com,github.com,google.com,ibm.com,live.com,meta.com,x.com,youtube.com")
try { try {
Write-Host "✅ Ping latency is" -noNewline
$hostsArray = $hosts.Split(",") $hostsArray = $hosts.Split(",")
$t = $hostsArray | foreach { $parallelTasks = $hostsArray | foreach {
(New-Object Net.NetworkInformation.Ping).SendPingAsync($_, 250) (New-Object Net.NetworkInformation.Ping).SendPingAsync($_, 500)
} }
[Threading.Tasks.Task]::WaitAll($t)
[int]$min = 9999999 [int]$min = 9999999
[int]$max = [int]$avg = [int]$successCount = [int]$lossCount = 0 [int]$max = [int]$avg = [int]$successCount = [int]$lossCount = 0
foreach($ping in $t.Result) { [int]$totalCount = $hostsArray.Count
[Threading.Tasks.Task]::WaitAll($parallelTasks)
foreach($ping in $parallelTasks.Result) {
if ($ping.Status -eq "Success") { if ($ping.Status -eq "Success") {
[int]$latency = $ping.RoundtripTime [int]$latency = $ping.RoundtripTime
if ($latency -lt $min) { $min = $Latency } if ($latency -lt $min) { $min = $latency }
if ($latency -gt $max) { $max = $Latency } if ($latency -gt $max) { $max = $latency }
$avg += $latency $avg += $latency
$successCount++ $successCount++
} else { } else {
$lossCount++ $lossCount++
} }
} }
$avg /= $successCount if ($successCount -eq 0) {
Write-Host " $($avg)ms average ($($min)ms...$($max)ms, $lossCount loss)" Write-Host "⚠️ Offline ($lossCount/$totalCount loss)"
} else {
$avg /= $successCount
Write-Host "✅ Ping latency is $($avg)ms average ($($min)ms...$($max)ms, $lossCount/$totalCount loss)"
}
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
@ -88,4 +92,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-ping.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-ping.ps1 as of 09/01/2023 17:51:49)*

93
Docs/check-power.md Normal file
View File

@ -0,0 +1,93 @@
*check-power.ps1*
================
This PowerShell script queries the power status and prints it.
Parameters
----------
```powershell
PS> ./check-power.ps1 [<CommonParameters>]
[<CommonParameters>]
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
```
Example
-------
```powershell
PS> ./check-power.ps1
⚠️ Battery at 9% (54 min remaining) with power scheme: HP Optimized
```
Notes
-----
Author: Markus Fleschutz | License: CC0
Related Links
-------------
https://github.com/fleschutz/PowerShell
Script Content
--------------
```powershell
<#
.SYNOPSIS
Checks the power status
.DESCRIPTION
This PowerShell script queries the power status and prints it.
.EXAMPLE
PS> ./check-power.ps1
⚠️ Battery at 9% (54 min remaining) with power scheme: HP Optimized
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
if ($IsLinux) {
$Reply = "✅ AC powered" # TODO, just guessing :-)
} else {
Add-Type -Assembly System.Windows.Forms
$Details = [System.Windows.Forms.SystemInformation]::PowerStatus
[int]$Percent = 100 * $Details.BatteryLifePercent
[int]$Remaining = $Details.BatteryLifeRemaining / 60
if ($Details.PowerLineStatus -eq "Online") {
if ($Details.BatteryChargeStatus -eq "NoSystemBattery") {
$Reply = "✅ AC powered"
} elseif ($Percent -ge 95) {
$Reply = "✅ Battery fully charged ($Percent%)"
} else {
$Reply = "✅ Battery charging... ($Percent%)"
}
} else { # must be offline
if ($Remaining -eq 0) {
$Reply = "✅ Battery at $Percent%"
} elseif ($Remaining -le 5) {
$Reply = "⚠️ Battery at $Percent%, ONLY $Remaining MIN remaining"
} elseif ($Remaining -le 30) {
$Reply = "⚠️ Battery at $Percent%, only $Remaining min remaining"
} elseif ($Percent -lt 10) {
$Reply = "⚠️ Battery at $Percent% with $Remaining min remaining"
} elseif ($Percent -ge 80) {
$Reply = "✅ Battery $Percent% full with $Remaining min remaining"
} else {
$Reply = "✅ Battery at $Percent% with $Remaining min remaining"
}
}
$PowerScheme = (powercfg /getactivescheme)
$PowerScheme = $PowerScheme -Replace "^(.*) \(",""
$PowerScheme = $PowerScheme -Replace "\)$",""
$Reply += ", power scheme is '$PowerScheme'"
}
Write-Output $Reply
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}
```
*(generated by convert-ps2md.ps1 using the comment-based help of check-power.ps1 as of 09/01/2023 17:51:49)*

View File

@ -64,4 +64,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-powershell.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-powershell.ps1 as of 09/01/2023 17:51:49)*

View File

@ -76,4 +76,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-ps1-file.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-ps1-file.ps1 as of 09/01/2023 17:51:49)*

View File

@ -19,12 +19,12 @@ Script Content
```powershell ```powershell
<# <#
.SYNOPSIS .SYNOPSIS
Check the RAM status Checks the RAM
.DESCRIPTION .DESCRIPTION
This PowerShell script queries the status of the installed RAM and prints it. This PowerShell script queries the status of the installed RAM memory modules and prints it.
.EXAMPLE .EXAMPLE
PS> ./check-ram.ps1 PS> ./check-ram.ps1
✅ 16GB DDR4 RAM @ 3200MHz (1.2V) in P0 CHANNEL A/DIMM 0 by Samsung ✅ 16GB DDR4 RAM @ 3200MHz by Micron (in CPU0/CPU0-DIMM3 @ 1.2V)
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -88,7 +88,7 @@ try {
[float]$Voltage = $Bank.ConfiguredVoltage / 1000.0 [float]$Voltage = $Bank.ConfiguredVoltage / 1000.0
$Manufacturer = $Bank.Manufacturer $Manufacturer = $Bank.Manufacturer
$Location = "$($Bank.BankLabel)/$($Bank.DeviceLocator)" $Location = "$($Bank.BankLabel)/$($Bank.DeviceLocator)"
Write-Host "✅ $Capacity $Type @ $($Speed)MHz ($($Voltage)V) in $Location by $Manufacturer" Write-Host "✅ $Capacity $Type @ $($Speed)MHz by $Manufacturer (in $Location @ $($Voltage)V)"
} }
} }
exit 0 # success exit 0 # success
@ -98,4 +98,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-ram.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-ram.ps1 as of 09/01/2023 17:51:49)*

View File

@ -128,4 +128,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-repo.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-repo.ps1 as of 09/01/2023 17:51:49)*

View File

@ -56,4 +56,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-santa.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-santa.ps1 as of 09/01/2023 17:51:49)*

View File

@ -95,4 +95,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-smart-devices.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-smart-devices.ps1 as of 09/01/2023 17:51:49)*

View File

@ -21,7 +21,8 @@ PS> ./check-software.ps1
S O F T W A R E S O F T W A R E
✅ BIOS 'P62 v02.67', release HPQOEM - 0, S/N CZC448B9C1 by HP ✅ BIOS model 'P62 v02.67' version HPQOEM - 0 by HP
✅ Windows 10 Pro 64-Bit (v10.0.19045, since 5/2/2021)
... ...
``` ```
@ -46,7 +47,8 @@ Script Content
PS> ./check-software.ps1 PS> ./check-software.ps1
S O F T W A R E S O F T W A R E
✅ BIOS 'P62 v02.67', release HPQOEM - 0, S/N CZC448B9C1 by HP ✅ BIOS model 'P62 v02.67' version HPQOEM - 0 by HP
✅ Windows 10 Pro 64-Bit (v10.0.19045, since 5/2/2021)
... ...
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
@ -58,8 +60,8 @@ Script Content
& "$PSScriptRoot/write-green.ps1" " S O F T W A R E" & "$PSScriptRoot/write-green.ps1" " S O F T W A R E"
& "$PSScriptRoot/check-bios.ps1" & "$PSScriptRoot/check-bios.ps1"
& "$PSScriptRoot/check-os.ps1" & "$PSScriptRoot/check-os.ps1"
& "$PSScriptRoot/check-powershell.ps1"
& "$PSScriptRoot/check-apps.ps1" & "$PSScriptRoot/check-apps.ps1"
& "$PSScriptRoot/check-powershell.ps1"
& "$PSScriptRoot/check-uptime.ps1" & "$PSScriptRoot/check-uptime.ps1"
& "$PSScriptRoot/check-time-zone.ps1" & "$PSScriptRoot/check-time-zone.ps1"
& "$PSScriptRoot/check-swap-space.ps1" & "$PSScriptRoot/check-swap-space.ps1"
@ -67,4 +69,4 @@ Script Content
exit 0 # success exit 0 # success
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-software.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-software.ps1 as of 09/01/2023 17:51:49)*

View File

@ -84,4 +84,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-subnet-mask.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-subnet-mask.ps1 as of 09/01/2023 17:51:49)*

View File

@ -6,10 +6,10 @@ This PowerShell script queries the status of the swap space and prints it.
Parameters Parameters
---------- ----------
```powershell ```powershell
PS> ./check-swap-space.ps1 [[-MinLevel] <Int32>] [<CommonParameters>] PS> ./check-swap-space.ps1 [[-minLevel] <Int32>] [<CommonParameters>]
-MinLevel <Int32> -minLevel <Int32>
Specifies the minimum level (10 GB by default) Specifies the minimum level in GB (10 GB by default)
Required? false Required? false
Position? 1 Position? 1
@ -26,7 +26,7 @@ Example
------- -------
```powershell ```powershell
PS> ./check-swap-space.ps1 PS> ./check-swap-space.ps1
✅ Swap space with 1GB at 42%, 748MB free ✅ Swap space uses 42% of 1GB, 748MB free
``` ```
@ -46,18 +46,18 @@ Script Content
Checks the swap space status Checks the swap space status
.DESCRIPTION .DESCRIPTION
This PowerShell script queries the status of the swap space and prints it. This PowerShell script queries the status of the swap space and prints it.
.PARAMETER MinLevel .PARAMETER minLevel
Specifies the minimum level (10 GB by default) Specifies the minimum level in GB (10 GB by default)
.EXAMPLE .EXAMPLE
PS> ./check-swap-space.ps1 PS> ./check-swap-space.ps1
✅ Swap space with 1GB at 42%, 748MB free ✅ Swap space uses 42% of 1GB, 748MB free
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
param([int]$MinLevel = 10) # minimum level in GB param([int]$minLevel = 10)
function MB2String { param([int64]$Bytes) function MB2String { param([int64]$Bytes)
if ($Bytes -lt 1000) { return "$($Bytes)MB" } if ($Bytes -lt 1000) { return "$($Bytes)MB" }
@ -72,35 +72,31 @@ function MB2String { param([int64]$Bytes)
} }
try { try {
[int]$Total = [int]$Used = [int]$Free = 0 [int64]$Total = [int64]$Used = [int64]$Free = 0
if ($IsLinux) { if ($IsLinux) {
$Result = $(free --mega | grep Swap:) $Result = $(free --mega | grep Swap:)
[int]$Total = $Result.subString(5,14) [int64]$Total = $Result.subString(5,14)
[int]$Used = $Result.substring(20,13) [int64]$Used = $Result.substring(20,13)
[int]$Free = $Result.substring(32,11) [int64]$Free = $Result.substring(32,11)
} else { } else {
$Items = Get-WmiObject -class "Win32_PageFileUsage" -namespace "root\CIMV2" -computername localhost $Items = Get-WmiObject -class "Win32_PageFileUsage" -namespace "root\CIMV2" -computername localhost
foreach ($Item in $Items) { foreach ($Item in $Items) {
$Total = $Item.AllocatedBaseSize $Total += $Item.AllocatedBaseSize
$Used = $Item.CurrentUsage $Used += $Item.CurrentUsage
$Free = ($Total - $Used) $Free += ($Total - $Used)
} }
} }
if ($Total -eq 0) { if ($Total -eq 0) {
Write-Output "⚠️ No swap space configured" Write-Output "⚠️ No swap space configured"
} elseif ($Free -eq 0) { } elseif ($Free -eq 0) {
Write-Output "⚠️ Swap space with $(MB2String $Total) is full" Write-Output "⚠️ Swap space of $(MB2String $Total) is full"
} elseif ($Free -lt $MinLevel) { } elseif ($Free -lt $minLevel) {
Write-Output "⚠️ Swap space with $(MB2String $Total) is nearly full, only $(MB2String $Free) free" Write-Output "⚠️ Swap space of $(MB2String $Total) is nearly full, only $(MB2String $Free) free"
} elseif ($Used -eq 0) { } elseif ($Used -eq 0) {
Write-Output "✅ Swap space with $(MB2String $Total) reserved" Write-Output "✅ Swap space of $(MB2String $Total) reserved"
} else { } else {
[int]$Percent = ($Used * 100) / $Total [int]$Percent = ($Used * 100) / $Total
if ($Percent -ge 90) { Write-Output "✅ Swap space uses $Percent% of $(MB2String $Total), $(MB2String $Free) free"
Write-Output "✅ Swap space with $(MB2String $Total) is $Percent% full, $(MB2String $Free) free"
} else {
Write-Output "✅ Swap space with $(MB2String $Total) at $Percent%, $(MB2String $Free) free"
}
} }
exit 0 # success exit 0 # success
} catch { } catch {
@ -109,4 +105,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-swap-space.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-swap-space.ps1 as of 09/01/2023 17:51:49)*

View File

@ -100,4 +100,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-symlinks.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-symlinks.ps1 as of 09/01/2023 17:51:49)*

View File

@ -65,4 +65,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-time-zone.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-time-zone.ps1 as of 09/01/2023 17:51:49)*

View File

@ -82,4 +82,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-uptime.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-uptime.ps1 as of 09/01/2023 17:51:49)*

View File

@ -1,7 +1,7 @@
*check-vpn.ps1* *check-vpn.ps1*
================ ================
This PowerShell script queries and prints the status of the VPN connection(s). This PowerShell script queries the status of the VPN connection(s) and prints it.
Parameters Parameters
---------- ----------
@ -17,7 +17,7 @@ Example
------- -------
```powershell ```powershell
PS> ./check-vpn.ps1 PS> ./check-vpn.ps1
✅ VPN to NASA L2TP is disconnected ✅ VPN disconnected to NASA L2TP
``` ```
@ -36,10 +36,10 @@ Script Content
.SYNOPSIS .SYNOPSIS
Checks the VPN status Checks the VPN status
.DESCRIPTION .DESCRIPTION
This PowerShell script queries and prints the status of the VPN connection(s). This PowerShell script queries the status of the VPN connection(s) and prints it.
.EXAMPLE .EXAMPLE
PS> ./check-vpn.ps1 PS> ./check-vpn.ps1
✅ VPN to NASA L2TP is disconnected ✅ VPN disconnected to NASA L2TP
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -47,17 +47,17 @@ Script Content
#> #>
try { try {
$NoVPN = $true $noVPN = $true
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 $($Connection.ConnectionStatus.ToLower()) to $($Connection.Name)"
$NoVPN = $false $noVPN = $false
} }
} }
if ($NoVPN) { Write-Host "⚠️ No VPN configured" } if ($noVPN) { Write-Host "⚠️ No VPN configured" }
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
@ -65,4 +65,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-vpn.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-vpn.ps1 as of 09/01/2023 17:51:49)*

View File

@ -81,4 +81,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-weather.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-weather.ps1 as of 09/01/2023 17:51:49)*

View File

@ -54,4 +54,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-week.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-week.ps1 as of 09/01/2023 17:51:49)*

View File

@ -72,4 +72,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-wind.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-wind.ps1 as of 09/01/2023 17:51:49)*

View File

@ -60,4 +60,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-windows-system-files.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-windows-system-files.ps1 as of 09/01/2023 17:51:49)*

View File

@ -88,4 +88,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-xml-file.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of check-xml-file.ps1 as of 09/01/2023 17:51:49)*

View File

@ -26,12 +26,12 @@ PS> ./clean-repo.ps1 [[-RepoDir] <String>] [<CommonParameters>]
Example Example
------- -------
```powershell ```powershell
PS> ./clean-repo C:\base256unicode PS> ./clean-repo.ps1 C:\rust
⏳ (1/4) Searching for Git executable... git version 2.41.0.windows.3 ⏳ (1/4) Searching for Git executable... git version 2.41.0.windows.3
⏳ (2/4) Checking local repository... 📂C:\base256unicode ⏳ (2/4) Checking local repository... 📂C:\rust
⏳ (3/4) Removing untracked files in repository... ⏳ (3/4) Removing untracked files in repository...
⏳ (4/4) Removing untracked files in submodules... ⏳ (4/4) Removing untracked files in submodules...
✔️ Cleaning the 📂base256unicode repo took 1 sec ✔️ Cleaned repo 📂rust in 1 sec
``` ```
@ -55,12 +55,12 @@ Script Content
.PARAMETER RepoDir .PARAMETER RepoDir
Specifies the file path to the local Git repository Specifies the file path to the local Git repository
.EXAMPLE .EXAMPLE
PS> ./clean-repo C:\base256unicode PS> ./clean-repo.ps1 C:\rust
⏳ (1/4) Searching for Git executable... git version 2.41.0.windows.3 ⏳ (1/4) Searching for Git executable... git version 2.41.0.windows.3
⏳ (2/4) Checking local repository... 📂C:\base256unicode ⏳ (2/4) Checking local repository... 📂C:\rust
⏳ (3/4) Removing untracked files in repository... ⏳ (3/4) Removing untracked files in repository...
⏳ (4/4) Removing untracked files in submodules... ⏳ (4/4) Removing untracked files in submodules...
✔️ Cleaning the 📂base256unicode repo took 1 sec ✔️ Cleaned repo 📂rust in 1 sec
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -93,7 +93,7 @@ try {
if ($lastExitCode -ne "0") { throw "'git clean' in the submodules failed with exit code $lastExitCode" } if ($lastExitCode -ne "0") { throw "'git clean' in the submodules failed with exit code $lastExitCode" }
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds [int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✔️ Cleaning the 📂$RepoDirName repo took $Elapsed sec" "✔️ Cleaned repo 📂$RepoDirName in $Elapsed sec"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
@ -101,4 +101,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of clean-repo.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of clean-repo.ps1 as of 09/01/2023 17:51:49)*

View File

@ -92,4 +92,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of clean-repos.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of clean-repos.ps1 as of 09/01/2023 17:51:49)*

View File

@ -60,4 +60,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of clear-dns-cache.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of clear-dns-cache.ps1 as of 09/01/2023 17:51:49)*

View File

@ -58,4 +58,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of clear-recycle-bin.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of clear-recycle-bin.ps1 as of 09/01/2023 17:51:49)*

View File

@ -27,7 +27,7 @@ Example
```powershell ```powershell
PS> ./clone-repos C:\Repos PS> ./clone-repos C:\Repos
⏳ (1) Searching for Git executable... git version 2.41.0.windows.3 ⏳ (1) Searching for Git executable... git version 2.41.0.windows.3
⏳ (2) Loading Data/popular-git-repos.csv... 28 repos ⏳ (2) Reading Data/popular-repositories.csv... 28 repos
⏳ (3) Checking target folder... 📂repos ⏳ (3) Checking target folder... 📂repos
⏳ (4/32) Cloning into 📂base256unicode (dev tool)... ⏳ (4/32) Cloning into 📂base256unicode (dev tool)...
... ...
@ -55,7 +55,7 @@ Script Content
.EXAMPLE .EXAMPLE
PS> ./clone-repos C:\Repos PS> ./clone-repos C:\Repos
⏳ (1) Searching for Git executable... git version 2.41.0.windows.3 ⏳ (1) Searching for Git executable... git version 2.41.0.windows.3
⏳ (2) Loading Data/popular-git-repos.csv... 28 repos ⏳ (2) Reading Data/popular-repositories.csv... 28 repos
⏳ (3) Checking target folder... 📂repos ⏳ (3) Checking target folder... 📂repos
⏳ (4/32) Cloning into 📂base256unicode (dev tool)... ⏳ (4/32) Cloning into 📂base256unicode (dev tool)...
... ...
@ -74,8 +74,8 @@ try {
& git --version & git --version
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" } if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
Write-Host "⏳ (2) Loading Data/popular-git-repos.csv... " -noNewline Write-Host "⏳ (2) Reading Data/popular-repositories.csv... " -noNewline
$Table = Import-CSV "$PSScriptRoot/../Data/popular-git-repos.csv" $Table = Import-CSV "$PSScriptRoot/../Data/popular-repositories.csv"
$NumEntries = $Table.count $NumEntries = $Table.count
Write-Host "$NumEntries repos" Write-Host "$NumEntries repos"
@ -90,7 +90,7 @@ try {
[string]$FolderName = $Row.FOLDERNAME [string]$FolderName = $Row.FOLDERNAME
[string]$Category = $Row.CATEGORY [string]$Category = $Row.CATEGORY
[string]$Branch = $Row.BRANCH [string]$Branch = $Row.BRANCH
[string]$Full = $Row.FULL [string]$Shallow = $Row.SHALLOW
[string]$URL = $Row.URL [string]$URL = $Row.URL
$Step++ $Step++
@ -99,14 +99,14 @@ try {
$Skipped++ $Skipped++
continue continue
} }
if ($Full -eq "yes") { if ($Shallow -eq "yes") {
"⏳ ($Step/$($NumEntries + 4)) Cloning into 📂$FolderName ($Category) - $Branch branch with full history..."
& git clone --branch "$Branch" --recurse-submodules "$URL" "$TargetDir/$FolderName"
if ($lastExitCode -ne "0") { throw "'git clone --branch $Branch $URL' failed with exit code $lastExitCode" }
} else {
"⏳ ($Step/$($NumEntries + 4)) Cloning into 📂$FolderName ($Category) - $Branch branch only..." "⏳ ($Step/$($NumEntries + 4)) Cloning into 📂$FolderName ($Category) - $Branch branch only..."
& git clone --branch "$Branch" --single-branch --recurse-submodules "$URL" "$TargetDir/$FolderName" & git clone --branch "$Branch" --single-branch --recurse-submodules "$URL" "$TargetDir/$FolderName"
if ($lastExitCode -ne "0") { throw "'git clone --branch $Branch $URL' failed with exit code $lastExitCode" } if ($lastExitCode -ne "0") { throw "'git clone --branch $Branch $URL' failed with exit code $lastExitCode" }
} else {
"⏳ ($Step/$($NumEntries + 4)) Cloning into 📂$FolderName ($Category) - $Branch branch with full history..."
& git clone --branch "$Branch" --recurse-submodules "$URL" "$TargetDir/$FolderName"
if ($lastExitCode -ne "0") { throw "'git clone --branch $Branch $URL' failed with exit code $lastExitCode" }
} }
$Cloned++ $Cloned++
} }
@ -119,4 +119,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of clone-repos.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of clone-repos.ps1 as of 09/01/2023 17:51:49)*

View File

@ -48,4 +48,4 @@ Stop-Process -name "CalculatorApp"
exit 0 # success exit 0 # success
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of close-calculator.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of close-calculator.ps1 as of 09/01/2023 17:51:49)*

View File

@ -48,4 +48,4 @@ Script Content
exit 0 # success exit 0 # success
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of close-chrome.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of close-chrome.ps1 as of 09/01/2023 17:51:49)*

View File

@ -48,4 +48,4 @@ Script Content
exit 0 # success exit 0 # success
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of close-cortana.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of close-cortana.ps1 as of 09/01/2023 17:51:49)*

View File

@ -52,4 +52,4 @@ if ($lastExitCode -ne "0") {
exit 0 # success exit 0 # success
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of close-edge.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of close-edge.ps1 as of 09/01/2023 17:51:49)*

View File

@ -48,4 +48,4 @@ Script Content
exit 0 # success exit 0 # success
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of close-file-explorer.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of close-file-explorer.ps1 as of 09/01/2023 17:51:49)*

View File

@ -48,4 +48,4 @@ Script Content
exit 0 # success exit 0 # success
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of close-firefox.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of close-firefox.ps1 as of 09/01/2023 17:51:49)*

View File

@ -52,4 +52,4 @@ if ($lastExitCode -ne "0") {
exit 0 # success exit 0 # success
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of close-git-extensions.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of close-git-extensions.ps1 as of 09/01/2023 17:51:49)*

View File

@ -48,4 +48,4 @@ tskill magnify
exit 0 # success exit 0 # success
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of close-magnifier.ps1 as of 08/06/2023 21:36:06)* *(generated by convert-ps2md.ps1 using the comment-based help of close-magnifier.ps1 as of 09/01/2023 17:51:49)*

Some files were not shown because too many files have changed in this diff Show More