Updated the Markdown manuals

This commit is contained in:
Markus Fleschutz 2024-05-19 10:25:56 +02:00
parent c24030c909
commit 439fbf5bfa
621 changed files with 2430 additions and 1289 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 03/27/2024 17:36:23)*
*(generated by convert-ps2md.ps1 using the comment-based help of add-firewall-rules.ps1 as of 05/19/2024 10:25:16)*

View File

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

View File

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

View File

@ -74,22 +74,36 @@ function BuildInDir([string]$path) {
"⏳ (2/4) Executing 'cmake' to generate the Makefile..."
& cmake ..
if ($lastExitCode -ne "0") { throw "Executing 'cmake ..' has failed" }
if ($lastExitCode -ne "0") { throw "Executing 'cmake ..' exited with error code $lastExitCode" }
"⏳ (3/4) Executing 'make -j4' to compile and link..."
& make -j4
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' exited with error code $lastExitCode" }
"⏳ (4/4) Executing 'ctest -V' to perform tests (optional)..."
& ctest -V
if ($lastExitCode -ne "0") { throw "Executing 'make test' has failed" }
if ($lastExitCode -ne "0") { throw "Executing 'ctest -V' exited with error code $lastExitCode" }
} elseif (Test-Path "$path/autogen.sh" -pathType leaf) {
"⏳ Building 📂$dirName by using 'autogen.sh'..."
Set-Location "$path/"
& ./autogen.sh --force
if ($lastExitCode -ne "0") { throw "Executing './autogen.sh --force' exited with error code $lastExitCode" }
& ./configure
if ($lastExitCode -ne "0") { throw "Executing './configure' exited with error code $lastExitCode" }
& make -j4
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' exited with error code $lastExitCode" }
} elseif (Test-Path "$path/configure" -pathType leaf) {
"⏳ Building 📂$dirName by using 'configure'..."
Set-Location "$path/"
& ./configure
#if ($lastExitCode -ne "0") { throw "Script 'configure' exited with error code $lastExitCode" }
#if ($lastExitCode -ne "0") { throw "Executing './configure' exited with error code $lastExitCode" }
& make -j4
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
@ -97,31 +111,21 @@ function BuildInDir([string]$path) {
& make test
if ($lastExitCode -ne "0") { throw "Executing 'make test' has failed" }
} elseif (Test-Path "$path/autogen.sh" -pathType leaf) {
"⏳ Building 📂$dirName by using 'autogen.sh'..."
Set-Location "$path/"
& ./autogen.sh
if ($lastExitCode -ne "0") { throw "Script 'autogen.sh' exited with error code $lastExitCode" }
& make -j4
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
} elseif (Test-Path "$path/build.gradle" -pathType leaf) {
"⏳ Building 📂$dirName by using Gradle..."
Set-Location "$path"
& gradle build
if ($lastExitCode -ne "0") { throw "'gradle build' has failed" }
if ($lastExitCode -ne "0") { throw "Executing 'gradle build' exited with error code $lastExitCode" }
& gradle test
if ($lastExitCode -ne "0") { throw "'gradle test' has failed" }
if ($lastExitCode -ne "0") { throw "Executing 'gradle test' exited with error code $lastExitCode" }
} elseif (Test-Path "$path/meson.build" -pathType leaf) {
"⏳ Building 📂$dirName by using Meson..."
Set-Location "$path"
& meson . build --prefix=/usr/local
if ($lastExitCode -ne "0") { throw "'meson . build' has failed" }
if ($lastExitCode -ne "0") { throw "Executing 'meson . build' exited with error code $lastExitCode" }
} elseif (Test-Path "$path/Imakefile" -pathType leaf) {
"⏳ Building 📂$dirName by using Imakefile..."
@ -152,7 +156,7 @@ function BuildInDir([string]$path) {
Set-Location "$path/"
& ./compile.sh
if ($lastExitCode -ne "0") { throw "Script 'compile.sh' exited with error code $lastExitCode" }
if ($lastExitCode -ne "0") { throw "Executing './compile.sh' exited with error code $lastExitCode" }
& make -j4
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
@ -162,7 +166,7 @@ function BuildInDir([string]$path) {
Set-Location "$path/attower/src/build/DevBuild/"
& ./build.bat build-all-release
if ($lastExitCode -ne "0") { throw "Script 'build.bat' exited with error code $lastExitCode" }
if ($lastExitCode -ne "0") { throw "Executing 'build.bat build-all-release' exited with error code $lastExitCode" }
} elseif (Test-Path "$path/$dirName" -pathType container) {
"⏳ No make rule found, trying subfolder 📂$($dirName)..."
@ -192,4 +196,4 @@ try {
}
```
*(generated by convert-ps2md.ps1 using the comment-based help of build-repo.ps1 as of 03/27/2024 17:36:23)*
*(generated by convert-ps2md.ps1 using the comment-based help of build-repo.ps1 as of 05/19/2024 10:25:16)*

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -19,7 +19,7 @@ Script Content
```powershell
<#
.SYNOPSIS
Sets the working directory to the user's recycle bin folder
Sets the working directory to the recycle bin folder
.DESCRIPTION
This PowerShell script changes the working directory to the user's recycle bin folder.
.EXAMPLE
@ -39,13 +39,13 @@ function GetCurrentUserSID { [CmdletBinding()] param()
try {
if ($IsLinux) {
$Path = "$HOME/.local/share/Trash/"
$path = "$HOME/.local/share/Trash/"
} else {
$Path = "C:\$Recycle.Bin\" + "$(GetCurrentUserSID)"
$path = "C:\`$Recycle.Bin\$(GetCurrentUserSID)"
}
if (-not(Test-Path "$Path" -pathType container)) { throw "Recycle bin folder at 📂$Path doesn't exist (yet)" }
Set-Location "$Path"
"📂$Path"
if (-not(Test-Path "$path" -pathType container)) { throw "Recycle bin folder at 📂$path doesn't exist (yet)" }
Set-Location "$path"
"📂$path"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
@ -53,4 +53,4 @@ try {
}
```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-recycle-bin.ps1 as of 03/27/2024 17:36:23)*
*(generated by convert-ps2md.ps1 using the comment-based help of cd-recycle-bin.ps1 as of 05/19/2024 10:25:17)*

93
docs/cd-repo.md Normal file
View File

@ -0,0 +1,93 @@
Script: *cd-repo.ps1*
========================
This PowerShell script changes the working directory to a Git repository.
Parameters
----------
```powershell
PS> ./cd-repo.ps1 [[-folderName] <String>] [<CommonParameters>]
-folderName <String>
Specifies the folder name
Required? false
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
[<CommonParameters>]
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
```
Example
-------
```powershell
PS> ./cd-repo.ps1 rust
📂C:\Repos\rust • on Git branch: ## main ... origin/main
```
Notes
-----
Author: Markus Fleschutz | License: CC0
Related Links
-------------
https://github.com/fleschutz/PowerShell
Script Content
--------------
```powershell
<#
.SYNOPSIS
Sets the working directory to a repository
.DESCRIPTION
This PowerShell script changes the working directory to a Git repository.
.PARAMETER folderName
Specifies the folder name
.EXAMPLE
PS> ./cd-repo.ps1 rust
📂C:\Repos\rust • on Git branch: ## main ... origin/main
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
param([string]$folderName = "")
try {
if ("$folderName" -eq "") { $folderName = Read-Host "Enter the folder name" }
if (Test-Path "$HOME/Repos/" -pathType Container) { # try short name
$path = "$HOME/Repos/"
} elseif (Test-Path "$HOME/repos/" -pathType Container) {
$path = "$HOME/repos/"
} elseif (Test-Path "$HOME/Repositories/" -pathType Container) { # try long name
$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 {
throw "The folder for Git repositories doesn't exist (yet)"
}
$path += $folderName
if (-not(Test-Path "$path" -pathType Container)) { throw "The path to 📂$path doesn't exist (yet)" }
$path = Resolve-Path "$path"
Set-Location "$path"
Write-Host "📂$path • on Git branch: " -noNewline
& git status --short --branch --show-stash
exit 0 # success
} catch {
"⚠️ Error: $($Error[0])"
exit 1
}
```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-repo.ps1 as of 05/19/2024 10:25:17)*

View File

@ -6,16 +6,7 @@ This PowerShell script changes the working directory to the user's Git repositor
Parameters
----------
```powershell
PS> ./cd-repos.ps1 [[-subpath] <String>] [<CommonParameters>]
-subpath <String>
Specifies an additional relative subpath (optional)
Required? false
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
PS> ./cd-repos.ps1 [<CommonParameters>]
[<CommonParameters>]
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
@ -25,15 +16,9 @@ PS> ./cd-repos.ps1 [[-subpath] <String>] [<CommonParameters>]
Example
-------
```powershell
PS> ./cd-repos
PS> ./cd-repos.ps1
📂C:\Users\Markus\Repos
PS> ./cd-repos rust
📂C:\Users\Markus\Repos\rust
on branch: ## main ... origin/main
```
Notes
@ -55,20 +40,14 @@ Script Content
.PARAMETER subpath
Specifies an additional relative subpath (optional)
.EXAMPLE
PS> ./cd-repos
PS> ./cd-repos.ps1
📂C:\Users\Markus\Repos
PS> ./cd-repos rust
📂C:\Users\Markus\Repos\rust
on branch: ## main ... origin/main
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
param([string]$subpath = "")
try {
if (Test-Path "$HOME/Repos/" -pathType Container) { # try short name
$path = "$HOME/Repos/"
@ -83,16 +62,10 @@ try {
} else {
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
}
exit 0 # success
} catch {
"⚠️ Error: $($Error[0])"
@ -100,4 +73,4 @@ try {
}
```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-repos.ps1 as of 03/27/2024 17:36:23)*
*(generated by convert-ps2md.ps1 using the comment-based help of cd-repos.ps1 as of 05/19/2024 10:25:17)*

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -19,7 +19,7 @@ Script Content
```powershell
<#
.SYNOPSIS
Sets the working directory to the user's trash folder
Sets the working directory to the trash folder
.DESCRIPTION
This PowerShell script changes the working directory to the user's trash folder.
.EXAMPLE
@ -39,13 +39,13 @@ function GetCurrentUserSID { [CmdletBinding()] param()
try {
if ($IsLinux) {
$Path = "$HOME/.local/share/Trash/"
$path = "$HOME/.local/share/Trash/"
} else {
$Path = "C:\$Recycle.Bin\" + "$(GetCurrentUserSID)"
$path = "C:\`$Recycle.Bin\$(GetCurrentUserSID)"
}
if (-not(Test-Path "$Path" -pathType container)) { throw "Trash folder at 📂$Path doesn't exist (yet)" }
Set-Location "$Path"
"📂$Path"
if (-not(Test-Path "$path" -pathType container)) { throw "Trash folder at 📂$path doesn't exist (yet)" }
Set-Location "$path"
"📂$path"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
@ -53,4 +53,4 @@ try {
}
```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-trash.ps1 as of 03/27/2024 17:36:23)*
*(generated by convert-ps2md.ps1 using the comment-based help of cd-trash.ps1 as of 05/19/2024 10:25:17)*

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,34 +1,19 @@
Script: *check-apps.ps1*
========================
This PowerShell script queries the installed applications and prints it.
check-apps.ps1
Parameters
----------
```powershell
PS> ./check-apps.ps1 [<CommonParameters>]
[<CommonParameters>]
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
```
Example
-------
```powershell
PS> ./check-apps.ps1
✅ 119 Windows apps installed, 11 upgrades available
```
Notes
-----
Author: Markus Fleschutz | License: CC0
Related Links
-------------
https://github.com/fleschutz/PowerShell
Script Content
--------------
```powershell
@ -46,28 +31,43 @@ Script Content
Author: Markus Fleschutz | License: CC0
#>
function GetCrashDumps {
[string]$path = Resolve-Path -Path "~\AppData\Local\CrashDumps"
$count = 0
$files = (Get-ChildItem -path "$path\*.dmp" -attributes !Directory)
foreach($file in $files) { $count++ }
return $count
}
try {
$statusIcon = "✅"
$statusMsg = ""
if ($IsLinux) {
Write-Progress "Querying installed applications..."
$numPkgs = (apt list --installed 2>/dev/null).Count
$numSnaps = (snap list).Count - 1
Write-Progress -Completed "."
Write-Host "✅ $numPkgs Debian packages, $numSnaps snaps installed"
Write-Progress -completed "Done."
$statusMsg += "$numPkgs Debian packages, $numSnaps snaps installed"
} else {
Write-Progress "Querying installed applications..."
Write-Progress "Querying installed apps..."
$Apps = Get-AppxPackage
Write-Progress -Completed "."
Write-Host "✅ $($Apps.Count) Windows apps installed, " -noNewline
Write-Progress -completed "Done."
$statusMsg = "$($Apps.Count) Win apps installed"
[int]$NumNonOk = 0
foreach($App in $Apps) { if ($App.Status -ne "Ok") { $NumNonOk++ } }
if ($NumNonOk -gt 0) { $Status += ", $NumNonOk non-ok" }
[int]$NumErrors = (Get-AppxLastError)
if ($NumErrors -gt 0) { $Status += ", $NumErrors errors" }
[int]$numNonOk = 0
foreach($App in $Apps) { if ($App.Status -ne "Ok") { $numNonOk++ } }
if ($numNonOk -gt 0) { $statusIcon = "⚠️"; $statusMsg += ", $numNonOk non-ok" }
$NumUpdates = (winget upgrade --include-unknown).Count - 5
Write-Host "$NumUpdates upgrades available"
[int]$numErrors = (Get-AppxLastError)
if ($numErrors -gt 0) { $statusIcon = "⚠️"; $statusMsg += ", $numErrors errors" }
$numUpdates = (winget upgrade --include-unknown).Count - 5
$statusMsg += ", $numUpdates upgrades available"
$crashDumps = GetCrashDumps
if ($crashDumps -ne 0) { $statusIcon = "⚠️"; $statusMsg += ", $crashDumps crash dumps found" }
}
Write-Host "$statusIcon $statusMsg"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
@ -75,4 +75,4 @@ try {
}
```
*(generated by convert-ps2md.ps1 using the comment-based help of check-apps.ps1 as of 03/27/2024 17:36:24)*
*(generated by convert-ps2md.ps1 using the comment-based help of check-apps.ps1 as of 05/19/2024 10:25:17)*

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -110,4 +110,4 @@ try {
}
```
*(generated by convert-ps2md.ps1 using the comment-based help of check-drive-space.ps1 as of 03/27/2024 17:36:24)*
*(generated by convert-ps2md.ps1 using the comment-based help of check-drive-space.ps1 as of 05/19/2024 10:25:17)*

View File

@ -100,4 +100,4 @@ try {
}
```
*(generated by convert-ps2md.ps1 using the comment-based help of check-drives.ps1 as of 03/27/2024 17:36:24)*
*(generated by convert-ps2md.ps1 using the comment-based help of check-drives.ps1 as of 05/19/2024 10:25:17)*

View File

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

View File

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

View File

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

View File

@ -170,4 +170,4 @@ function Check-Header { param( $path )
Check-Header $Path
```
*(generated by convert-ps2md.ps1 using the comment-based help of check-file.ps1 as of 03/27/2024 17:36:24)*
*(generated by convert-ps2md.ps1 using the comment-based help of check-file.ps1 as of 05/19/2024 10:25:17)*

View File

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

View File

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

View File

@ -52,8 +52,7 @@ Script Content
Author: Markus Fleschutz | License: CC0
#>
" "
& "$PSScriptRoot/write-green.ps1" " H A R D W A R E"
Write-Host "`n H A R D W A R E" -foregroundColor green
& "$PSScriptRoot/check-cpu.ps1"
& "$PSScriptRoot/check-ram.ps1"
& "$PSScriptRoot/check-gpu.ps1"
@ -64,4 +63,4 @@ Script Content
exit 0 # success
```
*(generated by convert-ps2md.ps1 using the comment-based help of check-hardware.ps1 as of 03/27/2024 17:36:24)*
*(generated by convert-ps2md.ps1 using the comment-based help of check-hardware.ps1 as of 05/19/2024 10:25:17)*

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -54,8 +54,7 @@ Script Content
Author: Markus Fleschutz | License: CC0
#>
" "
& "$PSScriptRoot/write-green.ps1" " N E T W O R K"
Write-Host "`n N E T W O R K" -foregroundColor green
& "$PSScriptRoot/ping-remote-hosts.ps1"
& "$PSScriptRoot/check-firewall"
& "$PSScriptRoot/check-dns.ps1"
@ -65,4 +64,4 @@ Script Content
exit 0 # success
```
*(generated by convert-ps2md.ps1 using the comment-based help of check-network.ps1 as of 03/27/2024 17:36:24)*
*(generated by convert-ps2md.ps1 using the comment-based help of check-network.ps1 as of 05/19/2024 10:25:18)*

View File

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

View File

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

View File

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

View File

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

View File

@ -24,7 +24,7 @@ Script Content
This PowerShell script queries pending operating system reboots and prints it.
.EXAMPLE
./check-pending-reboot.ps1
✅ No pending system reboot
✅ No pending reboot
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -79,11 +79,11 @@ try {
$Reason += ", '...\CurrentControlSet\Services\Netlogon' with 'AvoidSpnSet'"
}
if ($Reason -ne "") {
Write-Host "⚠️ Pending reboot (registry contains $($Reason.substring(2)))"
Write-Host "⚠️ Pending reboot (registry got $($Reason.substring(2)))"
}
}
if ($Reason -eq "") {
Write-Host "✅ No pending system reboot"
Write-Host "✅ No pending reboot"
}
exit 0 # success
} catch {
@ -92,4 +92,4 @@ try {
}
```
*(generated by convert-ps2md.ps1 using the comment-based help of check-pending-reboot.ps1 as of 03/27/2024 17:36:24)*
*(generated by convert-ps2md.ps1 using the comment-based help of check-pending-reboot.ps1 as of 05/19/2024 10:25:18)*

View File

@ -92,4 +92,4 @@ try {
}
```
*(generated by convert-ps2md.ps1 using the comment-based help of check-power.ps1 as of 03/27/2024 17:36:24)*
*(generated by convert-ps2md.ps1 using the comment-based help of check-power.ps1 as of 05/19/2024 10:25:18)*

View File

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

View File

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

View File

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

View File

@ -1,15 +1,15 @@
Script: *check-repo.ps1*
========================
This PowerShell script verifies the integrity of a local Git repository.
This PowerShell script verifies the integrity of a local Git repository and performs maintenance tasks.
Parameters
----------
```powershell
PS> ./check-repo.ps1 [[-RepoDir] <String>] [<CommonParameters>]
PS> ./check-repo.ps1 [[-pathToRepo] <String>] [<CommonParameters>]
-RepoDir <String>
Specifies the path to the Git repository (current working directory by default)
-pathToRepo <String>
Specifies the file path to the local Git repository (current working directory by default)
Required? false
Position? 1
@ -27,11 +27,11 @@ Example
```powershell
PS> ./check-repo.ps1 C:\MyRepo
⏳ (1/10) Searching for Git executable... git version 2.41.0.windows.3
⏳ (2/10) Checking local folder... 📂C:\MyRepo
⏳ (2/10) Checking local repository... 📂C:\MyRepo
⏳ (3/10) Querying remote URL... git@github.com:fleschutz/PowerShell.git
⏳ (4/10) Querying current branch... main
⏳ (5/10) Fetching remote updates...
⏳ (6/10) Querying latest tag... v0.8 (commit 02171a401d83b01a0cda0af426840b605e617f08)
⏳ (5/10) Fetching remote updates... OK
⏳ (6/10) Querying latest tag... v0.8 (at commit 02171a401d83b01a0cda0af426840b605e617f08)
⏳ (7/10) Verifying data integrity...
...
@ -50,19 +50,19 @@ Script Content
```powershell
<#
.SYNOPSIS
Checks a repo
Checks a Git repository
.DESCRIPTION
This PowerShell script verifies the integrity of a local Git repository.
.PARAMETER RepoDir
Specifies the path to the Git repository (current working directory by default)
This PowerShell script verifies the integrity of a local Git repository and performs maintenance tasks.
.PARAMETER pathToRepo
Specifies the file path to the local Git repository (current working directory by default)
.EXAMPLE
PS> ./check-repo.ps1 C:\MyRepo
⏳ (1/10) Searching for Git executable... git version 2.41.0.windows.3
⏳ (2/10) Checking local folder... 📂C:\MyRepo
⏳ (2/10) Checking local repository... 📂C:\MyRepo
⏳ (3/10) Querying remote URL... git@github.com:fleschutz/PowerShell.git
⏳ (4/10) Querying current branch... main
⏳ (5/10) Fetching remote updates...
⏳ (6/10) Querying latest tag... v0.8 (commit 02171a401d83b01a0cda0af426840b605e617f08)
⏳ (5/10) Fetching remote updates... OK
⏳ (6/10) Querying latest tag... v0.8 (at commit 02171a401d83b01a0cda0af426840b605e617f08)
⏳ (7/10) Verifying data integrity...
...
.LINK
@ -71,17 +71,17 @@ Script Content
Author: Markus Fleschutz | License: CC0
#>
param([string]$RepoDir = "$PWD")
param([string]$pathToRepo = "$PWD")
try {
$StopWatch = [system.diagnostics.stopwatch]::startNew()
$stopWatch = [system.diagnostics.stopwatch]::startNew()
Write-Host "⏳ (1/10) Searching for Git executable... " -noNewline
& git --version
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
Write-Host "⏳ (2/10) Checking local folder... " -noNewline
$FullPath = Resolve-Path "$RepoDir"
Write-Host "⏳ (2/10) Checking local repository... " -noNewline
$FullPath = Resolve-Path "$pathToRepo"
if (!(Test-Path "$FullPath" -pathType Container)) { throw "Can't access folder: $FullPath" }
"📂$FullPath"
@ -93,14 +93,15 @@ try {
& git -C "$FullPath" branch --show-current
if ($lastExitCode -ne "0") { throw "'git branch --show-current' failed with exit code $lastExitCode" }
Write-Host "⏳ (5/10) Fetching remote updates..."
& git -C "$FullPath" fetch
Write-Host "⏳ (5/10) Fetching remote updates... " -noNewline
& git -C "$FullPath" fetch --all --recurse-submodules --tags --force --quiet
if ($lastExitCode -ne "0") { throw "'git fetch' failed with exit code $lastExitCode" }
Write-Host "OK"
Write-Host "⏳ (6/10) Querying latest tag... " -noNewline
$LatestTagCommitID = (git -C "$FullPath" rev-list --tags --max-count=1)
$LatestTagName = (git -C "$FullPath" describe --tags $LatestTagCommitID)
Write-Host "$LatestTagName (commit $LatestTagCommitID)"
$latestTagCommitID = (git -C "$FullPath" rev-list --tags --max-count=1)
$latestTagName = (git -C "$FullPath" describe --tags $latestTagCommitID)
Write-Host "$latestTagName (at commit $latestTagCommitID)"
Write-Host "⏳ (7/10) Verifying data integrity..."
& git -C "$FullPath" fsck
@ -118,9 +119,9 @@ try {
& git -C "$FullPath" status
if ($lastExitCode -ne "0") { throw "'git status --short' failed with exit code $lastExitCode" }
$RepoDirName = (Get-Item "$FullPath").Name
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✔️ Checked repo 📂$RepoDirName in $Elapsed sec"
$repoDirName = (Get-Item "$FullPath").Name
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✔️ Checked repo 📂$repoDirName in $($elapsed)s."
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
@ -128,4 +129,4 @@ try {
}
```
*(generated by convert-ps2md.ps1 using the comment-based help of check-repo.ps1 as of 03/27/2024 17:36:25)*
*(generated by convert-ps2md.ps1 using the comment-based help of check-repo.ps1 as of 05/19/2024 10:25:18)*

View File

@ -1,7 +1,7 @@
Script: *check-repos.ps1*
========================
This PowerShell script checks all Git repositories in a folder.
This PowerShell script verifies the data integrity of all Git repositories in a folder.
Parameters
----------
@ -9,7 +9,7 @@ Parameters
PS> ./check-repos.ps1 [[-parentDir] <String>] [<CommonParameters>]
-parentDir <String>
Specifies the path to the parent folder
Specifies the file path to the parent folder
Required? false
Position? 1
@ -25,7 +25,11 @@ PS> ./check-repos.ps1 [[-parentDir] <String>] [<CommonParameters>]
Example
-------
```powershell
PS> ./check-repos.ps1 C:\MyRepos
PS> ./check-repos.ps1 C:\Repos
⏳ Checking parent folder 📂C:\Repos... 16 subfolders
⏳ Checking 📂rust repository (1/16)...
...
✔️ Checked all 16 Git repos in 📂C:\Repos in 356s.
```
@ -44,11 +48,15 @@ Script Content
.SYNOPSIS
Checks Git repositories
.DESCRIPTION
This PowerShell script checks all Git repositories in a folder.
This PowerShell script verifies the data integrity of all Git repositories in a folder.
.PARAMETER parentDir
Specifies the path to the parent folder
Specifies the file path to the parent folder
.EXAMPLE
PS> ./check-repos.ps1 C:\MyRepos
PS> ./check-repos.ps1 C:\Repos
⏳ Checking parent folder 📂C:\Repos... 16 subfolders
⏳ Checking 📂rust repository (1/16)...
...
✔️ Checked all 16 Git repos in 📂C:\Repos in 356s.
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -61,20 +69,21 @@ try {
$stopWatch = [system.diagnostics.stopwatch]::startNew()
$parentDirName = (Get-Item "$parentDir").Name
"⏳ Step 1 - Checking parent folder 📂$parentDirName..."
Write-Host "⏳ Checking parent folder 📂$parentDir... " -noNewline
if (-not(Test-Path "$parentDir" -pathType container)) { throw "Can't access folder: $parentDir" }
$folders = (Get-ChildItem "$parentDir" -attributes Directory)
$numFolders = $folders.Count
"Found $numFolders subfolders."
"$numFolders subfolders"
[int]$Step = 1
[int]$step = 1
foreach ($folder in $folders) {
"`n⏳ Checking 📂$folder repository ($step/$numFolders)..."
& "$PSScriptRoot/check-repo.ps1" "$folder"
$Step++
$step++
}
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✔️ Checked $numFolders Git repos at 📂$parentDirName in $elapsed sec"
"✔️ Checked all $numFolders Git repos in 📂$parentDir in $($elapsed)s."
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
@ -82,4 +91,4 @@ try {
}
```
*(generated by convert-ps2md.ps1 using the comment-based help of check-repos.ps1 as of 03/27/2024 17:36:25)*
*(generated by convert-ps2md.ps1 using the comment-based help of check-repos.ps1 as of 05/19/2024 10:25:18)*

View File

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

View File

@ -24,70 +24,91 @@ Script Content
This PowerShell script queries the status of the SSD/HDD devices (supporting S.M.A.R.T.) and prints it.
.EXAMPLE
PS> ./check-smart-devices.ps1
✅ 1TB Samsung SSD 970 EVO via NVMe (2388 hours, 289x on, v2B2QEXE7, 37°C, selftest passed)
✅ 1TB Samsung SSD 970 EVO via NVMe (37°C, 2388 hours, 289x on/off, v2B2QEXE7, selftest passed)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
function Bytes2String { param([int64]$Bytes)
if ($Bytes -lt 1000) { return "$Bytes bytes" }
$Bytes /= 1000
if ($Bytes -lt 1000) { return "$($Bytes)KB" }
$Bytes /= 1000
if ($Bytes -lt 1000) { return "$($Bytes)MB" }
$Bytes /= 1000
if ($Bytes -lt 1000) { return "$($Bytes)GB" }
$Bytes /= 1000
if ($Bytes -lt 1000) { return "$($Bytes)TB" }
$Bytes /= 1000
if ($Bytes -lt 1000) { return "$($Bytes)PB" }
$Bytes /= 1000
if ($Bytes -lt 1000) { return "$($Bytes)EB" }
function Bytes2String([int64]$bytes) {
if ($bytes -lt 1000) { return "$bytes bytes" }
$bytes /= 1000
if ($bytes -lt 1000) { return "$($bytes)KB" }
$bytes /= 1000
if ($bytes -lt 1000) { return "$($bytes)MB" }
$bytes /= 1000
if ($bytes -lt 1000) { return "$($bytes)GB" }
$bytes /= 1000
if ($bytes -lt 1000) { return "$($bytes)TB" }
$bytes /= 1000
if ($bytes -lt 1000) { return "$($bytes)PB" }
$bytes /= 1000
if ($bytes -lt 1000) { return "$($bytes)EB" }
}
try {
Write-Progress "(1/3) Searching for smartmontools..."
$Result = (smartctl --version)
$result = (smartctl --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'smartctl' - make sure smartmontools are installed" }
Write-Progress "(2/3) Scanning S.M.A.R.T devices..."
if ($IsLinux) {
$Devices = $(sudo smartctl --scan-open)
$devices = $(sudo smartctl --scan-open)
} else {
$Devices = $(smartctl --scan-open)
$devices = $(smartctl --scan-open)
}
foreach($Device in $Devices) {
Write-Progress "(3/3) Querying S.M.A.R.T devices..."
$Array = $Device.split(" ")
$Device = $Array[0]
if ("$Device" -eq "#") {
Write-Progress "(3/3) Querying S.M.A.R.T devices..."
foreach($device in $devices) {
$array = $device.split(" ")
$dev = $array[0]
if ("$dev" -eq "#") {
continue
} elseif ($IsLinux) {
$Details = (sudo smartctl --all --json $Device) | ConvertFrom-Json
$null = (sudo smartctl --test=short $Device)
$details = (sudo smartctl --all --json $dev) | ConvertFrom-Json
$null = (sudo smartctl --test=conveyance $dev)
} else {
$Details = (smartctl --all --json $Device) | ConvertFrom-Json
$null = (smartctl --test=short $Device)
$details = (smartctl --all --json $dev) | ConvertFrom-Json
$null = (smartctl --test=conveyance $dev)
}
$ModelName = $Details.model_name
$Protocol = $Details.device.protocol
[int64]$GBytes = $Details.user_capacity.bytes
if ($GBytes -gt 0) {
$Capacity = "$(Bytes2String $GBytes) "
$status = "✅"
$modelName = $details.model_name
$protocol = $details.device.protocol
[int64]$bytes = $details.user_capacity.bytes
if ($bytes -gt 0) {
$capacity = "$(Bytes2String $bytes) "
} else {
$Capacity = ""
$capacity = ""
}
$Temp = $Details.temperature.current
$Firmware = $Details.firmware_version
$PowerOn = $Details.power_cycle_count
$Hours = $Details.power_on_time.hours
if ($Details.smart_status.passed) { $Status = "passed" } else { $Status = "FAILED" }
Write-Progress -completed " "
Write-Host "✅ $($Capacity)$ModelName via $Protocol ($Hours hours, $($PowerOn)x on, v$($Firmware), $($Temp)°C, selftest $Status)"
if ($details.temperature.current -gt 50) {
$temp = "$($details.temperature.current)°C (!)"
$status = "⚠️"
} else {
$temp = "$($details.temperature.current)°C"
}
if ($details.power_on_time.hours -gt 87600) { # 10 years
$hours = "$($details.power_on_time.hours) hours (!)"
$status = "⚠️"
} else {
$hours = "$($details.power_on_time.hours) hours"
}
if ($details.power_cycle_count -gt 100000) {
$powerOn = "$($details.power_cycle_count)x on/off (!)"
$status = "⚠️"
} else {
$powerOn = "$($details.power_cycle_count)x on/off"
}
if ($details.smart_status.passed) {
$selftest = "selftest passed"
} else {
$selftest = "selftest FAILED"
$status = "⚠️"
}
$firmwareVersion = $details.firmware_version
Write-Host "$status $capacity$modelName via $protocol ($temp, $hours, $powerOn, $selftest, v$firmwareVersion)"
}
Write-Progress -completed " "
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
@ -95,4 +116,4 @@ try {
}
```
*(generated by convert-ps2md.ps1 using the comment-based help of check-smart-devices.ps1 as of 03/27/2024 17:36:25)*
*(generated by convert-ps2md.ps1 using the comment-based help of check-smart-devices.ps1 as of 05/19/2024 10:25:18)*

View File

@ -54,8 +54,7 @@ Script Content
Author: Markus Fleschutz | License: CC0
#>
" "
& "$PSScriptRoot/write-green.ps1" " S O F T W A R E"
Write-Host "`n S O F T W A R E" -foregroundColor green
& "$PSScriptRoot/check-os.ps1"
& "$PSScriptRoot/check-uptime.ps1"
& "$PSScriptRoot/check-apps.ps1"
@ -66,4 +65,4 @@ Script Content
exit 0 # success
```
*(generated by convert-ps2md.ps1 using the comment-based help of check-software.ps1 as of 03/27/2024 17:36:25)*
*(generated by convert-ps2md.ps1 using the comment-based help of check-software.ps1 as of 05/19/2024 10:25:18)*

View File

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

View File

@ -95,7 +95,7 @@ try {
} elseif ($free -lt $minLevel) {
Write-Output "⚠️ Swap space has only $(MB2String $free) of $(MB2String $total) free"
} elseif ($used -lt 5) {
Write-Output "✅ Swap space has the full $(MB2String $free) free"
Write-Output "✅ Swap space has all $(MB2String $free) free"
} else {
[int64]$percent = ($used * 100) / $total
Write-Output "✅ Swap space has $(MB2String $free) free ($percent% of $(MB2String $total) used)"
@ -107,4 +107,4 @@ try {
}
```
*(generated by convert-ps2md.ps1 using the comment-based help of check-swap-space.ps1 as of 03/27/2024 17:36:25)*
*(generated by convert-ps2md.ps1 using the comment-based help of check-swap-space.ps1 as of 05/19/2024 10:25:18)*

View File

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

View File

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

View File

@ -61,4 +61,4 @@ try {
}
```
*(generated by convert-ps2md.ps1 using the comment-based help of check-uptime.ps1 as of 03/27/2024 17:36:25)*
*(generated by convert-ps2md.ps1 using the comment-based help of check-uptime.ps1 as of 05/19/2024 10:25:18)*

View File

@ -51,9 +51,9 @@ try {
if ($IsLinux) {
# TODO
} else {
$Connections = Get-VPNConnection
foreach($Connection in $Connections) {
Write-Host "✅ VPN to $($Connection.Name) is $($Connection.ConnectionStatus.ToLower())"
$connections = Get-VPNConnection
foreach($connection in $connections) {
Write-Host "✅ VPN to $($connection.Name) is $($connection.ConnectionStatus.ToLower())"
$noVPN = $false
}
}
@ -65,4 +65,4 @@ try {
}
```
*(generated by convert-ps2md.ps1 using the comment-based help of check-vpn.ps1 as of 03/27/2024 17:36:25)*
*(generated by convert-ps2md.ps1 using the comment-based help of check-vpn.ps1 as of 05/19/2024 10:25:18)*

View File

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

View File

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

View File

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

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

View File

@ -85,4 +85,4 @@ try {
}
```
*(generated by convert-ps2md.ps1 using the comment-based help of check-xml-file.ps1 as of 03/27/2024 17:36:25)*
*(generated by convert-ps2md.ps1 using the comment-based help of check-xml-file.ps1 as of 05/19/2024 10:25:18)*

View File

@ -83,4 +83,4 @@ try {
}
```
*(generated by convert-ps2md.ps1 using the comment-based help of check-xml-files.ps1 as of 03/27/2024 17:36:25)*
*(generated by convert-ps2md.ps1 using the comment-based help of check-xml-files.ps1 as of 05/19/2024 10:25:18)*

View File

@ -31,7 +31,7 @@ PS> ./clean-repo.ps1 C:\rust
⏳ (2/4) Checking local repository... 📂C:\rust
⏳ (3/4) Removing untracked files in repository...
⏳ (4/4) Removing untracked files in submodules...
✔️ Cleaned up 📂rust repository in 1 sec.
✔️ Repo 📂rust is clean now (took 1s).
```
@ -60,7 +60,7 @@ Script Content
⏳ (2/4) Checking local repository... 📂C:\rust
⏳ (3/4) Removing untracked files in repository...
⏳ (4/4) Removing untracked files in submodules...
✔️ Cleaned up 📂rust repository in 1 sec.
✔️ Repo 📂rust is clean now (took 1s).
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -93,7 +93,7 @@ try {
if ($lastExitCode -ne "0") { throw "'git clean' in the submodules failed with exit code $lastExitCode" }
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✔️ Cleaned up 📂$repoName repository in $elapsed sec."
"✔️ Repo 📂$repoName is clean now (took $($elapsed)s)."
exit 0 # success
} catch {
"⚠️ 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 03/27/2024 17:36:25)*
*(generated by convert-ps2md.ps1 using the comment-based help of clean-repo.ps1 as of 05/19/2024 10:25:18)*

View File

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

View File

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

View File

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

View File

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

View File

@ -48,4 +48,4 @@ Stop-Process -name "CalculatorApp"
exit 0 # success
```
*(generated by convert-ps2md.ps1 using the comment-based help of close-calculator.ps1 as of 03/27/2024 17:36:25)*
*(generated by convert-ps2md.ps1 using the comment-based help of close-calculator.ps1 as of 05/19/2024 10:25:19)*

View File

@ -48,4 +48,4 @@ Script Content
exit 0 # success
```
*(generated by convert-ps2md.ps1 using the comment-based help of close-chrome.ps1 as of 03/27/2024 17:36:25)*
*(generated by convert-ps2md.ps1 using the comment-based help of close-chrome.ps1 as of 05/19/2024 10:25:19)*

View File

@ -48,4 +48,4 @@ Script Content
exit 0 # success
```
*(generated by convert-ps2md.ps1 using the comment-based help of close-cortana.ps1 as of 03/27/2024 17:36:25)*
*(generated by convert-ps2md.ps1 using the comment-based help of close-cortana.ps1 as of 05/19/2024 10:25:19)*

View File

@ -52,4 +52,4 @@ if ($lastExitCode -ne "0") {
exit 0 # success
```
*(generated by convert-ps2md.ps1 using the comment-based help of close-edge.ps1 as of 03/27/2024 17:36:25)*
*(generated by convert-ps2md.ps1 using the comment-based help of close-edge.ps1 as of 05/19/2024 10:25:19)*

View File

@ -48,4 +48,4 @@ Script Content
exit 0 # success
```
*(generated by convert-ps2md.ps1 using the comment-based help of close-file-explorer.ps1 as of 03/27/2024 17:36:25)*
*(generated by convert-ps2md.ps1 using the comment-based help of close-file-explorer.ps1 as of 05/19/2024 10:25:19)*

View File

@ -48,4 +48,4 @@ Script Content
exit 0 # success
```
*(generated by convert-ps2md.ps1 using the comment-based help of close-firefox.ps1 as of 03/27/2024 17:36:25)*
*(generated by convert-ps2md.ps1 using the comment-based help of close-firefox.ps1 as of 05/19/2024 10:25:19)*

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