Updated the manuals

This commit is contained in:
Markus Fleschutz 2024-03-27 17:36:59 +01:00
parent c5b5cb1c6e
commit aed2b7d940
610 changed files with 1754 additions and 1120 deletions

View File

@ -113,4 +113,4 @@ try {
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of add-firewall-rules.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of add-firewall-rules.ps1 as of 03/27/2024 17:36:23)*

View File

@ -79,4 +79,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of add-memo.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of add-memo.ps1 as of 03/27/2024 17:36:23)*

View File

@ -71,4 +71,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of alert.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of alert.ps1 as of 03/27/2024 17:36:23)*

View File

@ -9,7 +9,7 @@ Parameters
PS> ./build-repo.ps1 [[-path] <String>] [<CommonParameters>] PS> ./build-repo.ps1 [[-path] <String>] [<CommonParameters>]
-path <String> -path <String>
Specifies the path to the Git repository (current working dir by default) Specifies the path to the Git repository (default is current working directory)
Required? false Required? false
Position? 1 Position? 1
@ -26,9 +26,9 @@ Example
------- -------
```powershell ```powershell
PS> ./build-repo.ps1 C:\Repos\ninja PS> ./build-repo.ps1 C:\Repos\ninja
⏳ Building 📂ninja using CMakeLists.txt into 📂ninja/_My_Build... ⏳ Building 📂ninja using CMakeLists.txt into 📂ninja/_Build_Results...
... ...
✔️ Built 📂ninja in 47 sec ✔️ Built 📂ninja repository in 47 sec.
``` ```
@ -49,12 +49,12 @@ Script Content
.DESCRIPTION .DESCRIPTION
This PowerShell script builds a Git repository by supporting build systems such as: autogen, cmake, configure, Gradle, Imakefile, Makefile, and Meson. This PowerShell script builds a Git repository by supporting build systems such as: autogen, cmake, configure, Gradle, Imakefile, Makefile, and Meson.
.PARAMETER path .PARAMETER path
Specifies the path to the Git repository (current working dir by default) Specifies the path to the Git repository (default is current working directory)
.EXAMPLE .EXAMPLE
PS> ./build-repo.ps1 C:\Repos\ninja PS> ./build-repo.ps1 C:\Repos\ninja
⏳ Building 📂ninja using CMakeLists.txt into 📂ninja/_My_Build... ⏳ Building 📂ninja using CMakeLists.txt into 📂ninja/_Build_Results...
... ...
✔️ Built 📂ninja in 47 sec ✔️ Built 📂ninja repository in 47 sec.
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -66,11 +66,11 @@ param([string]$path = "$PWD")
function BuildInDir([string]$path) { function BuildInDir([string]$path) {
$dirName = (Get-Item "$path").Name $dirName = (Get-Item "$path").Name
if (Test-Path "$path/CMakeLists.txt" -pathType leaf) { if (Test-Path "$path/CMakeLists.txt" -pathType leaf) {
"⏳ (1/4) Building 📂$dirName by using CMake into 📂$dirName/_My_Build..." "⏳ (1/4) Building 📂$dirName by using CMake into 📂$dirName/_Build_Results..."
if (-not(Test-Path "$path/_My_Build/" -pathType container)) { if (-not(Test-Path "$path/_Build_Results/" -pathType container)) {
& mkdir "$path/_My_Build/" & mkdir "$path/_Build_Results/"
} }
Set-Location "$path/_My_Build/" Set-Location "$path/_Build_Results/"
"⏳ (2/4) Executing 'cmake' to generate the Makefile..." "⏳ (2/4) Executing 'cmake' to generate the Makefile..."
& cmake .. & cmake ..
@ -184,7 +184,7 @@ try {
$repoDirName = (Get-Item "$path").Name $repoDirName = (Get-Item "$path").Name
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds [int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✔️ Built repo 📂$repoDirName in $elapsed sec" "✔️ Built 📂$repoDirName repository 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])"
@ -192,4 +192,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of build-repo.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of build-repo.ps1 as of 03/27/2024 17:36:23)*

View File

@ -82,4 +82,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of build-repos.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of build-repos.ps1 as of 03/27/2024 17:36:23)*

View File

@ -60,4 +60,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-autostart.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-autostart.ps1 as of 03/27/2024 17:36:23)*

View File

@ -63,4 +63,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-crashdumps.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-crashdumps.ps1 as of 03/27/2024 17:36:23)*

View File

@ -64,4 +64,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-desktop.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-desktop.ps1 as of 03/27/2024 17:36:23)*

View File

@ -64,4 +64,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-docs.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-docs.ps1 as of 03/27/2024 17:36:23)*

View File

@ -64,4 +64,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-downloads.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-downloads.ps1 as of 03/27/2024 17:36:23)*

View File

@ -60,4 +60,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-dropbox.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-dropbox.ps1 as of 03/27/2024 17:36:23)*

View File

@ -64,4 +64,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-etc.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-etc.ps1 as of 03/27/2024 17:36:23)*

View File

@ -60,4 +60,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-fonts.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-fonts.ps1 as of 03/27/2024 17:36:23)*

View File

@ -60,4 +60,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-home.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-home.ps1 as of 03/27/2024 17:36:23)*

View File

@ -48,4 +48,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-logs.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-logs.ps1 as of 03/27/2024 17:36:23)*

View File

@ -64,4 +64,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-music.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-music.ps1 as of 03/27/2024 17:36:23)*

View File

@ -60,4 +60,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-onedrive.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-onedrive.ps1 as of 03/27/2024 17:36:23)*

View File

@ -62,4 +62,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-pics.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-pics.ps1 as of 03/27/2024 17:36:23)*

View File

@ -62,4 +62,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-public.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-public.ps1 as of 03/27/2024 17:36:23)*

View File

@ -53,4 +53,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-recycle-bin.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-recycle-bin.ps1 as of 03/27/2024 17:36:23)*

View File

@ -6,9 +6,9 @@ This PowerShell script changes the working directory to the user's Git repositor
Parameters Parameters
---------- ----------
```powershell ```powershell
PS> ./cd-repos.ps1 [[-Subpath] <String>] [<CommonParameters>] PS> ./cd-repos.ps1 [[-subpath] <String>] [<CommonParameters>]
-Subpath <String> -subpath <String>
Specifies an additional relative subpath (optional) Specifies an additional relative subpath (optional)
Required? false Required? false
@ -26,7 +26,13 @@ Example
------- -------
```powershell ```powershell
PS> ./cd-repos PS> ./cd-repos
📂C:\Users\Markus\source\Repos 📂C:\Users\Markus\Repos
PS> ./cd-repos rust
📂C:\Users\Markus\Repos\rust
on branch: ## main ... origin/main
``` ```
@ -46,33 +52,47 @@ Script Content
Sets the working directory to the user's repos folder Sets the working directory to the user's repos folder
.DESCRIPTION .DESCRIPTION
This PowerShell script changes the working directory to the user's Git repositories folder. This PowerShell script changes the working directory to the user's Git repositories folder.
.PARAMETER Subpath .PARAMETER subpath
Specifies an additional relative subpath (optional) Specifies an additional relative subpath (optional)
.EXAMPLE .EXAMPLE
PS> ./cd-repos PS> ./cd-repos
📂C:\Users\Markus\source\Repos 📂C:\Users\Markus\Repos
PS> ./cd-repos rust
📂C:\Users\Markus\Repos\rust
on branch: ## main ... origin/main
.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]$Subpath = "") param([string]$subpath = "")
try { try {
if (Test-Path "$HOME/Repos" -pathType Container) { # try short name if (Test-Path "$HOME/Repos/" -pathType Container) { # try short name
$Path = "$HOME/Repos/$Subpath" $path = "$HOME/Repos/"
} elseif (Test-Path "$HOME/Repositories" -pathType Container) { # try long name } elseif (Test-Path "$HOME/repos/" -pathType Container) {
$Path = "$HOME/Repositories/$Subpath" $path = "$HOME/repos/"
} elseif (Test-Path "$HOME/source/repos" -pathType Container) { # try Visual Studio default } elseif (Test-Path "$HOME/Repositories/" -pathType Container) { # try long name
$Path = "$HOME/source/repos/$Subpath" $path = "$HOME/Repositories/"
} elseif (Test-Path "$HOME/source/repos/" -pathType Container) { # try Visual Studio default
$path = "$HOME/source/repos/"
} elseif (Test-Path "/Repos/" -pathType Container) {
$path = "/Repos/"
} else { } else {
throw "The folder for Git repositories in your home directory doesn't exist (yet)." throw "The folder for Git repositories doesn't exist (yet)"
}
if ("$subpath" -ne "") { $path += $subpath }
if (-not(Test-Path "$path" -pathType Container)) { throw "The path to 📂$path doesn't exist (yet)" }
$path = Resolve-Path "$path"
Set-Location "$path"
"📂$path"
if ("$subpath" -ne "") {
Write-Host -noNewline " on branch: "
& git status --short --branch --show-stash
} }
if (-not(Test-Path "$Path" -pathType Container)) { throw "The path to 📂$Path doesn't exist (yet)." }
$Path = Resolve-Path "$Path"
Set-Location "$Path"
"📂$Path"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ Error: $($Error[0])"
@ -80,4 +100,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-repos.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-repos.ps1 as of 03/27/2024 17:36:23)*

View File

@ -57,4 +57,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-root.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-root.ps1 as of 03/27/2024 17:36:23)*

View File

@ -55,4 +55,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-screenshots.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-screenshots.ps1 as of 03/27/2024 17:36:23)*

View File

@ -17,7 +17,7 @@ Example
------- -------
```powershell ```powershell
PS> ./cd-scripts PS> ./cd-scripts
📂C:\Users\Markus\source\repos\PowerShell\scripts 📂C:\Users\Markus\Repos\PowerShell\scripts
``` ```
@ -39,7 +39,7 @@ Script Content
This PowerShell script changes the working directory to the PowerShell scripts folder. This PowerShell script changes the working directory to the PowerShell scripts folder.
.EXAMPLE .EXAMPLE
PS> ./cd-scripts PS> ./cd-scripts
📂C:\Users\Markus\source\repos\PowerShell\scripts 📂C:\Users\Markus\Repos\PowerShell\scripts
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -47,10 +47,10 @@ Script Content
#> #>
try { try {
$Path = Resolve-Path "$PSScriptRoot" $path = Resolve-Path "$PSScriptRoot"
if (-not(Test-Path "$Path" -pathType container)) { throw "PowerShell scripts folder at 📂$Path doesn't exist (yet)" } if (-not(Test-Path "$path" -pathType container)) { throw "PowerShell scripts folder at 📂$path doesn't exist (yet)" }
Set-Location "$Path" Set-Location "$path"
"📂$Path" "📂$path"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
@ -58,4 +58,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-scripts.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-scripts.ps1 as of 03/27/2024 17:36:23)*

View File

@ -58,4 +58,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-ssh.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-ssh.ps1 as of 03/27/2024 17:36:23)*

View File

@ -50,4 +50,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-temp.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-temp.ps1 as of 03/27/2024 17:36:23)*

View File

@ -62,4 +62,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-templates.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-templates.ps1 as of 03/27/2024 17:36:23)*

View File

@ -53,4 +53,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-trash.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-trash.ps1 as of 03/27/2024 17:36:23)*

View File

@ -58,4 +58,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-up.ps1 as of 03/27/2024 17:36:23)*

View File

@ -58,4 +58,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up2.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-up2.ps1 as of 03/27/2024 17:36:23)*

View File

@ -58,4 +58,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up3.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-up3.ps1 as of 03/27/2024 17:36:23)*

View File

@ -58,4 +58,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up4.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-up4.ps1 as of 03/27/2024 17:36:23)*

View File

@ -58,4 +58,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-users.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-users.ps1 as of 03/27/2024 17:36:23)*

View File

@ -62,4 +62,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-videos.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-videos.ps1 as of 03/27/2024 17:36:23)*

View File

@ -58,4 +58,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-windows.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-windows.ps1 as of 03/27/2024 17:36:24)*

View File

@ -79,4 +79,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of change-wallpaper.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of change-wallpaper.ps1 as of 03/27/2024 17:36:24)*

View File

@ -67,4 +67,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-admin.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-admin.ps1 as of 03/27/2024 17:36:24)*

View File

@ -75,4 +75,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-apps.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-apps.ps1 as of 03/27/2024 17:36:24)*

View File

@ -76,4 +76,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-bios.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-bios.ps1 as of 03/27/2024 17:36:24)*

View File

@ -101,4 +101,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-cpu.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-cpu.ps1 as of 03/27/2024 17:36:24)*

View File

@ -82,4 +82,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-credentials.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-credentials.ps1 as of 03/27/2024 17:36:24)*

View File

@ -57,4 +57,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-day.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-day.ps1 as of 03/27/2024 17:36:24)*

View File

@ -73,4 +73,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-dns.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-dns.ps1 as of 03/27/2024 17:36:24)*

View File

@ -35,7 +35,7 @@ Example
------- -------
```powershell ```powershell
PS> ./check-drive-space.ps1 C PS> ./check-drive-space.ps1 C
✅ Drive C: uses 56%, 442GB free of 999GB ✅ Drive C: has 442GB free (56% of 1TB used)
``` ```
@ -61,7 +61,7 @@ Script Content
Specifies the minimum level in bytes (10GB by default) Specifies the minimum level in bytes (10GB by default)
.EXAMPLE .EXAMPLE
PS> ./check-drive-space.ps1 C PS> ./check-drive-space.ps1 C
✅ Drive C: uses 56%, 442GB free of 999GB ✅ Drive C: has 442GB free (56% of 1TB used)
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -100,8 +100,8 @@ try {
} elseif ($free -lt $minLevel) { } elseif ($free -lt $minLevel) {
Write-Host "⚠️ Drive $driveName with $(Bytes2String $total) is nearly full, $(Bytes2String $free) free" Write-Host "⚠️ Drive $driveName with $(Bytes2String $total) is nearly full, $(Bytes2String $free) free"
} else { } else {
[int]$percent = ($used * 100) / $total [int64]$percent = ($used * 100) / $total
Write-Host "✅ Drive $driveName uses $percent%, $(Bytes2String $free) free of $(Bytes2String $total)" Write-Host "✅ Drive $driveName has $(Bytes2String $free) free ($percent% of $(Bytes2String $total) used)"
} }
exit 0 # success exit 0 # success
} catch { } catch {
@ -110,4 +110,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-drive-space.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-drive-space.ps1 as of 03/27/2024 17:36:24)*

View File

@ -9,7 +9,7 @@ Parameters
PS> ./check-drives.ps1 [[-minLevel] <Int64>] [<CommonParameters>] PS> ./check-drives.ps1 [[-minLevel] <Int64>] [<CommonParameters>]
-minLevel <Int64> -minLevel <Int64>
Specifies the minimum warning level (10 GB by default) Specifies the minimum warning level (10GB by default)
Required? false Required? false
Position? 1 Position? 1
@ -26,8 +26,8 @@ Example
------- -------
```powershell ```powershell
PS> ./check-drives.ps1 PS> ./check-drives.ps1
✅ Drive C: uses 49%, 512GB free of 1TB ✅ Drive C: has 512GB free (49% of 1TB used)
✅ Drive D: uses 84%, 641GB free of 4TB ✅ Drive D: has 641GB free (84% of 4TB used)
``` ```
@ -48,11 +48,11 @@ Script Content
.DESCRIPTION .DESCRIPTION
This PowerShell script queries the free space of all drives and prints it. 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 (10GB by default)
.EXAMPLE .EXAMPLE
PS> ./check-drives.ps1 PS> ./check-drives.ps1
✅ Drive C: uses 49%, 512GB free of 1TB ✅ Drive C: has 512GB free (49% of 1TB used)
✅ Drive D: uses 84%, 641GB free of 4TB ✅ Drive D: has 641GB free (84% of 4TB used)
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -61,24 +61,19 @@ Script Content
param([int64]$minLevel = 10) # 10 GB minimum param([int64]$minLevel = 10) # 10 GB minimum
function Bytes2String { param([int64]$bytes) function Bytes2String { param([int64]$number)
if ($bytes -lt 1000) { return "$bytes bytes" } if ($number -lt 1KB) { return "$number bytes" }
$bytes /= 1000 if ($number -lt 1MB) { return '{0:N0}KB' -f ($number / 1KB) }
if ($bytes -lt 1000) { return "$($bytes)KB" } if ($number -lt 1GB) { return '{0:N0}MB' -f ($number / 1MB) }
$bytes /= 1000 if ($number -lt 1TB) { return '{0:N0}GB' -f ($number / 1GB) }
if ($bytes -lt 1000) { return "$($bytes)MB" } if ($number -lt 1PB) { return '{0:N0}TB' -f ($number / 1TB) }
$bytes /= 1000 return '{0:N0}GB' -f ($number / 1PB)
if ($bytes -lt 1000) { return "$($bytes)GB" }
$bytes /= 1000
if ($bytes -lt 1000) { return "$($bytes)TB" }
$bytes /= 1000
return "$($bytes)PB"
} }
try { try {
Write-Progress "Querying drives..." Write-Progress "Querying drives..."
$drives = Get-PSDrive -PSProvider FileSystem $drives = Get-PSDrive -PSProvider FileSystem
$minLevel *= 1000 * 1000 * 1000 $minLevel *= 1GB
Write-Progress -completed " " Write-Progress -completed " "
foreach($drive in $drives) { foreach($drive in $drives) {
$details = (Get-PSDrive $drive.Name) $details = (Get-PSDrive $drive.Name)
@ -94,8 +89,8 @@ try {
} elseif ($free -lt $minLevel) { } elseif ($free -lt $minLevel) {
Write-Host "⚠️ Drive $name 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 [int64]$percent = ($used * 100) / $total
Write-Host "✅ Drive $name uses $percent%, $(Bytes2String $free) free of $(Bytes2String $total)" Write-Host "✅ Drive $name has $(Bytes2String $free) free ($percent% of $(Bytes2String $total) used)"
} }
} }
exit 0 # success exit 0 # success
@ -105,4 +100,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-drives.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-drives.ps1 as of 03/27/2024 17:36:24)*

View File

@ -63,4 +63,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-dusk.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-dusk.ps1 as of 03/27/2024 17:36:24)*

View File

@ -61,4 +61,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-easter-sunday.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-easter-sunday.ps1 as of 03/27/2024 17:36:24)*

View File

@ -75,4 +75,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-file-system.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-file-system.ps1 as of 03/27/2024 17:36:24)*

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 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-file.ps1 as of 03/27/2024 17:36:24)*

View File

@ -65,4 +65,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-firewall.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-firewall.ps1 as of 03/27/2024 17:36:24)*

View File

@ -65,4 +65,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-gpu.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-gpu.ps1 as of 03/27/2024 17:36:24)*

View File

@ -57,10 +57,11 @@ Script Content
& "$PSScriptRoot/check-cpu.ps1" & "$PSScriptRoot/check-cpu.ps1"
& "$PSScriptRoot/check-ram.ps1" & "$PSScriptRoot/check-ram.ps1"
& "$PSScriptRoot/check-gpu.ps1" & "$PSScriptRoot/check-gpu.ps1"
& "$PSScriptRoot/check-bios.ps1"
& "$PSScriptRoot/check-smart-devices.ps1" & "$PSScriptRoot/check-smart-devices.ps1"
& "$PSScriptRoot/check-drives.ps1"
& "$PSScriptRoot/check-power.ps1" & "$PSScriptRoot/check-power.ps1"
& "$PSScriptRoot/check-drives.ps1"
exit 0 # success exit 0 # success
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-hardware.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-hardware.ps1 as of 03/27/2024 17:36:24)*

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 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-health.ps1 as of 03/27/2024 17:36:24)*

View File

@ -61,4 +61,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-independence-day.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-independence-day.ps1 as of 03/27/2024 17:36:24)*

View File

@ -84,4 +84,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-ipv4-address.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-ipv4-address.ps1 as of 03/27/2024 17:36:24)*

View File

@ -98,4 +98,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-ipv6-address.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-ipv6-address.ps1 as of 03/27/2024 17:36:24)*

View File

@ -55,4 +55,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-iss-position.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-iss-position.ps1 as of 03/27/2024 17:36:24)*

View File

@ -87,4 +87,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-mac-address.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-mac-address.ps1 as of 03/27/2024 17:36:24)*

View File

@ -60,4 +60,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-midnight.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-midnight.ps1 as of 03/27/2024 17:36:24)*

View File

@ -57,4 +57,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-month.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-month.ps1 as of 03/27/2024 17:36:24)*

View File

@ -76,4 +76,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-moon-phase.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-moon-phase.ps1 as of 03/27/2024 17:36:24)*

View File

@ -65,4 +65,4 @@ Script Content
exit 0 # success exit 0 # success
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-network.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-network.ps1 as of 03/27/2024 17:36:24)*

View File

@ -60,4 +60,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-new-year.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-new-year.ps1 as of 03/27/2024 17:36:24)*

View File

@ -59,4 +59,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-noon.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-noon.ps1 as of 03/27/2024 17:36:24)*

View File

@ -73,4 +73,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-os.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-os.ps1 as of 03/27/2024 17:36:24)*

View File

@ -65,4 +65,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-outlook.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-outlook.ps1 as of 03/27/2024 17:36:24)*

View File

@ -94,4 +94,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-password.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-password.ps1 as of 03/27/2024 17:36:24)*

View File

@ -92,4 +92,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-pending-reboot.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-pending-reboot.ps1 as of 03/27/2024 17:36:24)*

View File

@ -58,7 +58,7 @@ try {
if ($details.BatteryChargeStatus -eq "NoSystemBattery") { if ($details.BatteryChargeStatus -eq "NoSystemBattery") {
$reply = "✅ AC powered" $reply = "✅ AC powered"
} elseif ($percent -ge 95) { } elseif ($percent -ge 95) {
$reply = "✅ Battery fully charged ($percent%)" $reply = "✅ Battery $percent% full"
} else { } else {
$reply = "✅ Battery charging ($percent%)" $reply = "✅ Battery charging ($percent%)"
} }
@ -92,4 +92,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-power.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-power.ps1 as of 03/27/2024 17:36:24)*

View File

@ -59,4 +59,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-powershell.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-powershell.ps1 as of 03/27/2024 17:36:24)*

View File

@ -76,4 +76,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-ps1-file.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-ps1-file.ps1 as of 03/27/2024 17:36:24)*

View File

@ -98,4 +98,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-ram.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-ram.ps1 as of 03/27/2024 17:36:24)*

View File

@ -128,4 +128,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-repo.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-repo.ps1 as of 03/27/2024 17:36:25)*

View File

@ -82,4 +82,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-repos.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-repos.ps1 as of 03/27/2024 17:36:25)*

View File

@ -56,4 +56,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-santa.ps1 as of 01/25/2024 13:58:36)* *(generated by convert-ps2md.ps1 using the comment-based help of check-santa.ps1 as of 03/27/2024 17:36:25)*

View File

@ -95,4 +95,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-smart-devices.ps1 as of 01/25/2024 13:58:37)* *(generated by convert-ps2md.ps1 using the comment-based help of check-smart-devices.ps1 as of 03/27/2024 17:36:25)*

View File

@ -21,7 +21,6 @@ PS> ./check-software.ps1
S O F T W A R E S O F T W A R E
✅ BIOS model 'P62 v02.67' version HPQOEM - 0 by HP
✅ Windows 10 Pro 64-Bit (v10.0.19045, since 5/2/2021) ✅ Windows 10 Pro 64-Bit (v10.0.19045, since 5/2/2021)
... ...
@ -47,7 +46,6 @@ 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 model 'P62 v02.67' version HPQOEM - 0 by HP
✅ Windows 10 Pro 64-Bit (v10.0.19045, since 5/2/2021) ✅ Windows 10 Pro 64-Bit (v10.0.19045, since 5/2/2021)
... ...
.LINK .LINK
@ -58,7 +56,6 @@ 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-os.ps1" & "$PSScriptRoot/check-os.ps1"
& "$PSScriptRoot/check-uptime.ps1" & "$PSScriptRoot/check-uptime.ps1"
& "$PSScriptRoot/check-apps.ps1" & "$PSScriptRoot/check-apps.ps1"
@ -69,4 +66,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 01/25/2024 13:58:37)* *(generated by convert-ps2md.ps1 using the comment-based help of check-software.ps1 as of 03/27/2024 17:36:25)*

View File

@ -84,4 +84,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-subnet-mask.ps1 as of 01/25/2024 13:58:37)* *(generated by convert-ps2md.ps1 using the comment-based help of check-subnet-mask.ps1 as of 03/27/2024 17:36:25)*

View File

@ -26,7 +26,7 @@ Example
------- -------
```powershell ```powershell
PS> ./check-swap-space.ps1 PS> ./check-swap-space.ps1
✅ Swap space uses 42%, 748MB free of 1GB ✅ Swap space has 748MB free (42% of 1GB used)
``` ```
@ -50,7 +50,7 @@ Script Content
Specifies the minimum level in GB (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 uses 42%, 748MB free of 1GB ✅ Swap space has 748MB free (42% of 1GB used)
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -59,44 +59,46 @@ Script Content
param([int]$minLevel = 10) 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" }
$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" } if ($bytes -lt 1000) { return "$($bytes)PB" }
$Bytes /= 1000 $bytes /= 1000
if ($Bytes -lt 1000) { return "$($Bytes)EB" } if ($bytes -lt 1000) { return "$($bytes)EB" }
} }
try { try {
[int64]$Total = [int64]$Used = [int64]$Free = 0
if ($IsLinux) { if ($IsLinux) {
$Result = $(free --mega | grep Swap:) $Result = $(free --mega | grep Swap:)
[int64]$Total = $Result.subString(5,14) [int64]$total = $Result.subString(5,14)
[int64]$Used = $Result.substring(20,13) [int64]$used = $Result.substring(20,13)
[int64]$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) { [int64]$total = [int64]$used = 0
$Total += $Item.AllocatedBaseSize foreach ($item in $items) {
$Used += $Item.CurrentUsage $total += $item.AllocatedBaseSize
$Free += ($Total - $Used) $used += $item.CurrentUsage
}
}
[int64]$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 of $(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 of $(MB2String $Total) is nearly full, only $(MB2String $Free) free" Write-Output "⚠️ Swap space has only $(MB2String $free) of $(MB2String $total) free"
} elseif ($Used -lt 5) { } elseif ($used -lt 5) {
Write-Output "✅ Swap space unused, $(MB2String $Free) free" Write-Output "✅ Swap space has the full $(MB2String $free) free"
} else { } else {
[int]$Percent = ($Used * 100) / $Total [int64]$percent = ($used * 100) / $total
Write-Output "✅ Swap space uses $Percent%, $(MB2String $Free) free of $(MB2String $Total)" Write-Output "✅ Swap space has $(MB2String $free) free ($percent% of $(MB2String $total) used)"
} }
exit 0 # success exit 0 # success
} catch { } catch {
@ -105,4 +107,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-swap-space.ps1 as of 01/25/2024 13:58:37)* *(generated by convert-ps2md.ps1 using the comment-based help of check-swap-space.ps1 as of 03/27/2024 17:36:25)*

View File

@ -100,4 +100,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-symlinks.ps1 as of 01/25/2024 13:58:37)* *(generated by convert-ps2md.ps1 using the comment-based help of check-symlinks.ps1 as of 03/27/2024 17:36:25)*

View File

@ -65,4 +65,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-time-zone.ps1 as of 01/25/2024 13:58:37)* *(generated by convert-ps2md.ps1 using the comment-based help of check-time-zone.ps1 as of 03/27/2024 17:36:25)*

View File

@ -24,14 +24,14 @@ Script Content
This PowerShell script queries the computer's uptime (time between now and last boot up time) and prints it. This PowerShell script queries the computer's uptime (time between now and last boot up time) and prints it.
.EXAMPLE .EXAMPLE
PS> ./check-uptime.ps1 PS> ./check-uptime.ps1
Up for 2 days, 20 hours, 10 minutes OfficePC is up for 13 days since 1/25/2024
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
function TimeSpan2String([TimeSpan]$uptime) function TimeSpanAsString([TimeSpan]$uptime)
{ {
[int]$days = $uptime.Days [int]$days = $uptime.Days
[int]$hours = $days * 24 + $uptime.Hours [int]$hours = $days * 24 + $uptime.Hours
@ -45,15 +45,15 @@ function TimeSpan2String([TimeSpan]$uptime)
} }
try { try {
[system.threading.thread]::currentthread.currentculture = [system.globalization.cultureinfo]"en-US"
if ($IsLinux) { if ($IsLinux) {
$lastBootTime = (Get-Uptime -since)
$uptime = (Get-Uptime) $uptime = (Get-Uptime)
Write-Host "✅ Up for $(TimeSpan2String $uptime)"
} else { } else {
[system.threading.thread]::currentthread.currentculture = [system.globalization.cultureinfo]"en-US"
$lastBootTime = (Get-CimInstance Win32_OperatingSystem).LastBootUpTime $lastBootTime = (Get-CimInstance Win32_OperatingSystem).LastBootUpTime
$uptime = New-TimeSpan -Start $lastBootTime -End (Get-Date) $uptime = New-TimeSpan -Start $lastBootTime -End (Get-Date)
Write-Host "✅ Up for $(TimeSpan2String $uptime) since $($lastBootTime.ToShortDateString())"
} }
Write-Host "✅ $(hostname) is up for $(TimeSpanAsString $uptime) since $($lastBootTime.ToShortDateString())"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
@ -61,4 +61,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-uptime.ps1 as of 01/25/2024 13:58:37)* *(generated by convert-ps2md.ps1 using the comment-based help of check-uptime.ps1 as of 03/27/2024 17:36:25)*

View File

@ -65,4 +65,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-vpn.ps1 as of 01/25/2024 13:58:37)* *(generated by convert-ps2md.ps1 using the comment-based help of check-vpn.ps1 as of 03/27/2024 17:36:25)*

View File

@ -81,4 +81,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-weather.ps1 as of 01/25/2024 13:58:37)* *(generated by convert-ps2md.ps1 using the comment-based help of check-weather.ps1 as of 03/27/2024 17:36:25)*

View File

@ -54,4 +54,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-week.ps1 as of 01/25/2024 13:58:37)* *(generated by convert-ps2md.ps1 using the comment-based help of check-week.ps1 as of 03/27/2024 17:36:25)*

View File

@ -72,4 +72,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-wind.ps1 as of 01/25/2024 13:58:37)* *(generated by convert-ps2md.ps1 using the comment-based help of check-wind.ps1 as of 03/27/2024 17:36:25)*

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 01/25/2024 13:58:37)* *(generated by convert-ps2md.ps1 using the comment-based help of check-windows-system-files.ps1 as of 03/27/2024 17:36:25)*

View File

@ -70,6 +70,7 @@ try {
$ReaderSettings.ValidationType = [System.Xml.ValidationType]::Schema $ReaderSettings.ValidationType = [System.Xml.ValidationType]::Schema
$ReaderSettings.ValidationFlags = [System.Xml.Schema.XmlSchemaValidationFlags]::ProcessInlineSchema -bor [System.Xml.Schema.XmlSchemaValidationFlags]::ProcessSchemaLocation $ReaderSettings.ValidationFlags = [System.Xml.Schema.XmlSchemaValidationFlags]::ProcessInlineSchema -bor [System.Xml.Schema.XmlSchemaValidationFlags]::ProcessSchemaLocation
$ReaderSettings.add_ValidationEventHandler({ $script:ErrorCount++ }) $ReaderSettings.add_ValidationEventHandler({ $script:ErrorCount++ })
$ReaderSettings.DtdProcessing = [System.Xml.DtdProcessing]::Parse
$Reader = [System.Xml.XmlReader]::Create($XmlFile.FullName, $ReaderSettings) $Reader = [System.Xml.XmlReader]::Create($XmlFile.FullName, $ReaderSettings)
while ($Reader.Read()) { } while ($Reader.Read()) { }
$Reader.Close() $Reader.Close()
@ -84,4 +85,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-xml-file.ps1 as of 01/25/2024 13:58:37)* *(generated by convert-ps2md.ps1 using the comment-based help of check-xml-file.ps1 as of 03/27/2024 17:36:25)*

View File

@ -1,7 +1,7 @@
Script: *check-xml-files.ps1* Script: *check-xml-files.ps1*
======================== ========================
This PowerShell script verifies each XML file (with suffix .xml) in the given directory tree for validity. This PowerShell script verifies any XML file (with suffix .xml) in the given directory tree for validity.
Parameters Parameters
---------- ----------
@ -27,7 +27,7 @@ Example
```powershell ```powershell
PS> ./check-xml-files.ps1 C:\Windows PS> ./check-xml-files.ps1 C:\Windows
... ...
✔️ Checked 3387 XML files within 📂C:\Windows in 174 sec ✔️ Checked 3387 XML files (2462 invalid, 925 valid) within 📂C:\Windows in 116 sec
``` ```
@ -46,13 +46,13 @@ Script Content
.SYNOPSIS .SYNOPSIS
Checks all XML files in a directory tree Checks all XML files in a directory tree
.DESCRIPTION .DESCRIPTION
This PowerShell script verifies each XML file (with suffix .xml) in the given directory tree for validity. This PowerShell script verifies any XML file (with suffix .xml) in the given directory tree for validity.
.PARAMETER path .PARAMETER path
Specifies the path to the directory tree (current working dir by default) Specifies the path to the directory tree (current working dir by default)
.EXAMPLE .EXAMPLE
PS> ./check-xml-files.ps1 C:\Windows PS> ./check-xml-files.ps1 C:\Windows
... ...
✔️ Checked 3387 XML files within 📂C:\Windows in 174 sec ✔️ Checked 3387 XML files (2462 invalid, 925 valid) within 📂C:\Windows in 116 sec
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -63,19 +63,19 @@ param([string]$path = "$PWD")
try { try {
$stopWatch = [system.diagnostics.stopwatch]::startNew() $stopWatch = [system.diagnostics.stopwatch]::startNew()
$path = Resolve-Path "$path" $path = Resolve-Path "$path"
[int]$numXmlFiles = 0 Write-Progress "Scanning any XML file within $path..."
[int]$valid = [int]$invalid = 0
Write-Progress "Scanning all XML files within $path..."
Get-ChildItem -path "$path" -attributes !Directory -recurse -force | Where-Object { $_.Name -like "*.xml" } | Foreach-Object { Get-ChildItem -path "$path" -attributes !Directory -recurse -force | Where-Object { $_.Name -like "*.xml" } | Foreach-Object {
& $PSScriptRoot/check-xml-file.ps1 "$($_.FullName)" & $PSScriptRoot/check-xml-file.ps1 "$($_.FullName)"
$numXmlFiles++ if ($lastExitCode -eq 0) { $valid++ } else { $invalid++ }
} }
Write-Progress -completed "Done." Write-Progress -completed "Done."
[int]$total = $valid + $invalid
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds [int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✔️ Checked $numXmlFiles XML files within 📂$path in $elapsed sec" "✔️ Checked $total XML files ($invalid invalid, $valid valid) within 📂$path 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])"
@ -83,4 +83,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-xml-files.ps1 as of 01/25/2024 13:58:37)* *(generated by convert-ps2md.ps1 using the comment-based help of check-xml-files.ps1 as of 03/27/2024 17:36:25)*

View File

@ -7,9 +7,9 @@ NOTE: To be used with care! This cannot be undone!
Parameters Parameters
---------- ----------
```powershell ```powershell
PS> ./clean-repo.ps1 [[-RepoDir] <String>] [<CommonParameters>] PS> ./clean-repo.ps1 [[-pathToRepo] <String>] [<CommonParameters>]
-RepoDir <String> -pathToRepo <String>
Specifies the file path to the local Git repository Specifies the file path to the local Git repository
Required? false Required? false
@ -31,7 +31,7 @@ PS> ./clean-repo.ps1 C:\rust
⏳ (2/4) Checking local repository... 📂C:\rust ⏳ (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...
✔️ Cleaned repo 📂rust in 1 sec ✔️ Cleaned up 📂rust repository in 1 sec.
``` ```
@ -52,7 +52,7 @@ Script Content
.DESCRIPTION .DESCRIPTION
This PowerShell script deletes all untracked files and folders in a local Git repository (including submodules). This PowerShell script deletes all untracked files and folders in a local Git repository (including submodules).
NOTE: To be used with care! This cannot be undone! NOTE: To be used with care! This cannot be undone!
.PARAMETER RepoDir .PARAMETER pathToRepo
Specifies the file path to the local Git repository Specifies the file path to the local Git repository
.EXAMPLE .EXAMPLE
PS> ./clean-repo.ps1 C:\rust PS> ./clean-repo.ps1 C:\rust
@ -60,40 +60,40 @@ Script Content
⏳ (2/4) Checking local repository... 📂C:\rust ⏳ (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...
✔️ Cleaned repo 📂rust in 1 sec ✔️ Cleaned up 📂rust repository in 1 sec.
.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]$RepoDir = "$PWD") param([string]$pathToRepo = "$PWD")
try { try {
$StopWatch = [system.diagnostics.stopwatch]::startNew() $stopWatch = [system.diagnostics.stopwatch]::startNew()
Write-Host "⏳ (1/4) Searching for Git executable... " -noNewline Write-Host "⏳ (1/4) Searching for Git executable... " -noNewline
& 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" }
"⏳ (2/4) Checking local repository... 📂$RepoDir" "⏳ (2/4) Checking local repository... 📂$pathToRepo"
if (-not(Test-Path "$RepoDir" -pathType container)) { throw "Can't access folder '$RepoDir' - maybe a typo or missing folder permissions?" } if (-not(Test-Path "$pathToRepo" -pathType container)) { throw "Can't access repo folder '$pathToRepo' - maybe a typo or missing folder permissions?" }
$RepoDirName = (Get-Item "$RepoDir").Name $repoName = (Get-Item "$pathToRepo").Name
"⏳ (3/4) Removing untracked files in repository..." "⏳ (3/4) Removing untracked files in repository..."
& git -C "$RepoDir" clean -xfd -f # to delete all untracked files in the main repo & git -C "$pathToRepo" clean -xfd -f # to delete all untracked files in the main repo
if ($lastExitCode -ne "0") { if ($lastExitCode -ne "0") {
Write-Warning "'git clean' failed with exit code $lastExitCode, retrying once..." Write-Warning "'git clean' failed with exit code $lastExitCode, retrying once..."
& git -C "$RepoDir" clean -xfd -f & git -C "$pathToRepo" clean -xfd -f
if ($lastExitCode -ne "0") { throw "'git clean' failed with exit code $lastExitCode" } if ($lastExitCode -ne "0") { throw "'git clean' failed with exit code $lastExitCode" }
} }
"⏳ (4/4) Removing untracked files in submodules..." "⏳ (4/4) Removing untracked files in submodules..."
& git -C "$RepoDir" submodule foreach --recursive git clean -xfd -f # to delete all untracked files in the submodules & git -C "$pathToRepo" submodule foreach --recursive git clean -xfd -f # to delete all untracked files in the submodules
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
"✔️ Cleaned repo 📂$RepoDirName in $Elapsed sec" "✔️ Cleaned up 📂$repoName repository 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 01/25/2024 13:58:37)* *(generated by convert-ps2md.ps1 using the comment-based help of clean-repo.ps1 as of 03/27/2024 17:36:25)*

View File

@ -100,4 +100,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of clean-repos.ps1 as of 01/25/2024 13:58:37)* *(generated by convert-ps2md.ps1 using the comment-based help of clean-repos.ps1 as of 03/27/2024 17:36:25)*

View File

@ -60,4 +60,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of clear-dns-cache.ps1 as of 01/25/2024 13:58:37)* *(generated by convert-ps2md.ps1 using the comment-based help of clear-dns-cache.ps1 as of 03/27/2024 17:36:25)*

View File

@ -58,4 +58,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of clear-recycle-bin.ps1 as of 01/25/2024 13:58:37)* *(generated by convert-ps2md.ps1 using the comment-based help of clear-recycle-bin.ps1 as of 03/27/2024 17:36:25)*

View File

@ -112,4 +112,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of clone-repos.ps1 as of 01/25/2024 13:58:37)* *(generated by convert-ps2md.ps1 using the comment-based help of clone-repos.ps1 as of 03/27/2024 17:36:25)*

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 01/25/2024 13:58:37)* *(generated by convert-ps2md.ps1 using the comment-based help of close-calculator.ps1 as of 03/27/2024 17:36:25)*

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 01/25/2024 13:58:37)* *(generated by convert-ps2md.ps1 using the comment-based help of close-chrome.ps1 as of 03/27/2024 17:36:25)*

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 01/25/2024 13:58:37)* *(generated by convert-ps2md.ps1 using the comment-based help of close-cortana.ps1 as of 03/27/2024 17:36:25)*

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 01/25/2024 13:58:37)* *(generated by convert-ps2md.ps1 using the comment-based help of close-edge.ps1 as of 03/27/2024 17:36:25)*

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 01/25/2024 13:58:37)* *(generated by convert-ps2md.ps1 using the comment-based help of close-file-explorer.ps1 as of 03/27/2024 17:36:25)*

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 01/25/2024 13:58:37)* *(generated by convert-ps2md.ps1 using the comment-based help of close-firefox.ps1 as of 03/27/2024 17:36:25)*

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