Updated the manuals

This commit is contained in:
Markus Fleschutz 2024-08-15 09:51:46 +02:00
parent 654d1a18d0
commit e1ffab5509
633 changed files with 2120 additions and 973 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 05/19/2024 10:25:16)* *(generated by convert-ps2md.ps1 using the comment-based help of add-firewall-rules.ps1 as of 08/15/2024 09:50:44)*

View File

@ -71,4 +71,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of alert.ps1 as of 05/19/2024 10:25:16)* *(generated by convert-ps2md.ps1 using the comment-based help of alert.ps1 as of 08/15/2024 09:50:44)*

View File

@ -196,4 +196,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of build-repo.ps1 as of 05/19/2024 10:25:16)* *(generated by convert-ps2md.ps1 using the comment-based help of build-repo.ps1 as of 08/15/2024 09:50:44)*

View File

@ -82,4 +82,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of build-repos.ps1 as of 05/19/2024 10:25:16)* *(generated by convert-ps2md.ps1 using the comment-based help of build-repos.ps1 as of 08/15/2024 09:50:44)*

View File

@ -60,4 +60,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-autostart.ps1 as of 05/19/2024 10:25:16)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-autostart.ps1 as of 08/15/2024 09:50:44)*

View File

@ -63,4 +63,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-crashdumps.ps1 as of 05/19/2024 10:25:16)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-crashdumps.ps1 as of 08/15/2024 09:50:44)*

View File

@ -64,4 +64,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-desktop.ps1 as of 05/19/2024 10:25:16)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-desktop.ps1 as of 08/15/2024 09:50:44)*

View File

@ -64,4 +64,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-docs.ps1 as of 05/19/2024 10:25:16)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-docs.ps1 as of 08/15/2024 09:50:44)*

View File

@ -64,4 +64,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-downloads.ps1 as of 05/19/2024 10:25:16)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-downloads.ps1 as of 08/15/2024 09:50:44)*

View File

@ -60,4 +60,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-dropbox.ps1 as of 05/19/2024 10:25:16)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-dropbox.ps1 as of 08/15/2024 09:50:44)*

View File

@ -64,4 +64,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-etc.ps1 as of 05/19/2024 10:25:16)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-etc.ps1 as of 08/15/2024 09:50:44)*

View File

@ -60,4 +60,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-fonts.ps1 as of 05/19/2024 10:25:16)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-fonts.ps1 as of 08/15/2024 09:50:44)*

View File

@ -60,4 +60,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-home.ps1 as of 05/19/2024 10:25:16)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-home.ps1 as of 08/15/2024 09:50:44)*

View File

@ -48,4 +48,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-logs.ps1 as of 05/19/2024 10:25:16)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-logs.ps1 as of 08/15/2024 09:50:44)*

View File

@ -64,4 +64,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-music.ps1 as of 05/19/2024 10:25:16)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-music.ps1 as of 08/15/2024 09:50:44)*

View File

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

View File

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

View File

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

63
docs/cd-recent.md Normal file
View File

@ -0,0 +1,63 @@
Script: *cd-recent.ps1*
========================
This PowerShell script changes the working directory to the 'recent' folder.
Parameters
----------
```powershell
PS> ./cd-recent.ps1 [<CommonParameters>]
[<CommonParameters>]
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
```
Example
-------
```powershell
PS> ./cd-recent
📂C:\Users\Markus\AppData\Roaming\Microsoft\Windows\Recent
```
Notes
-----
Author: Markus Fleschutz | License: CC0
Related Links
-------------
https://github.com/fleschutz/PowerShell
Script Content
--------------
```powershell
<#
.SYNOPSIS
Sets the working directory to the 'recent' folder
.DESCRIPTION
This PowerShell script changes the working directory to the 'recent' folder.
.EXAMPLE
PS> ./cd-recent
📂C:\Users\Markus\AppData\Roaming\Microsoft\Windows\Recent
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
$path = [Environment]::GetFolderPath('Recent')
if (-not(Test-Path "$path" -pathType container)) {
throw "Recent folder at 📂$path doesn't exist (yet)"
}
Set-Location "$path"
"📂$path"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}
```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-recent.ps1 as of 08/15/2024 09:50:44)*

View File

@ -53,4 +53,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-recycle-bin.ps1 as of 05/19/2024 10:25:17)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-recycle-bin.ps1 as of 08/15/2024 09:50:45)*

View File

@ -1,7 +1,7 @@
Script: *cd-repo.ps1* Script: *cd-repo.ps1*
======================== ========================
This PowerShell script changes the working directory to a Git repository. This PowerShell script changes the working directory to a local Git repository.
Parameters Parameters
---------- ----------
@ -9,7 +9,7 @@ Parameters
PS> ./cd-repo.ps1 [[-folderName] <String>] [<CommonParameters>] PS> ./cd-repo.ps1 [[-folderName] <String>] [<CommonParameters>]
-folderName <String> -folderName <String>
Specifies the folder name Specifies the Git repository's folder name
Required? false Required? false
Position? 1 Position? 1
@ -26,7 +26,7 @@ Example
------- -------
```powershell ```powershell
PS> ./cd-repo.ps1 rust PS> ./cd-repo.ps1 rust
📂C:\Repos\rust • on Git branch: ## main ... origin/main 📂C:\Repos\rust - current branch is: ## main ... origin/main
``` ```
@ -45,12 +45,12 @@ Script Content
.SYNOPSIS .SYNOPSIS
Sets the working directory to a repository Sets the working directory to a repository
.DESCRIPTION .DESCRIPTION
This PowerShell script changes the working directory to a Git repository. This PowerShell script changes the working directory to a local Git repository.
.PARAMETER folderName .PARAMETER folderName
Specifies the folder name Specifies the Git repository's folder name
.EXAMPLE .EXAMPLE
PS> ./cd-repo.ps1 rust PS> ./cd-repo.ps1 rust
📂C:\Repos\rust • on Git branch: ## main ... origin/main 📂C:\Repos\rust - current branch is: ## main ... origin/main
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -60,7 +60,7 @@ Script Content
param([string]$folderName = "") param([string]$folderName = "")
try { try {
if ("$folderName" -eq "") { $folderName = Read-Host "Enter the folder name" } if ("$folderName" -eq "") { $folderName = Read-Host "Enter the Git repository's folder name" }
if (Test-Path "$HOME/Repos/" -pathType Container) { # try short name if (Test-Path "$HOME/Repos/" -pathType Container) { # try short name
$path = "$HOME/Repos/" $path = "$HOME/Repos/"
@ -80,8 +80,7 @@ try {
if (-not(Test-Path "$path" -pathType Container)) { throw "The path to 📂$path doesn't exist (yet)" } if (-not(Test-Path "$path" -pathType Container)) { throw "The path to 📂$path doesn't exist (yet)" }
$path = Resolve-Path "$path" $path = Resolve-Path "$path"
Set-Location "$path" Set-Location "$path"
Write-Host "📂$path • on Git branch: " -noNewline Write-Host "📂$path - current branch is: " -noNewline
& git status --short --branch --show-stash & git status --short --branch --show-stash
exit 0 # success exit 0 # success
} catch { } catch {
@ -90,4 +89,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-repo.ps1 as of 05/19/2024 10:25:17)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-repo.ps1 as of 08/15/2024 09:50:45)*

View File

@ -73,4 +73,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-repos.ps1 as of 05/19/2024 10:25:17)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-repos.ps1 as of 08/15/2024 09:50:45)*

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -53,4 +53,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-trash.ps1 as of 05/19/2024 10:25:17)* *(generated by convert-ps2md.ps1 using the comment-based help of cd-trash.ps1 as of 08/15/2024 09:50:45)*

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -17,7 +17,7 @@ Example
------- -------
```powershell ```powershell
PS> ./check-admin.ps1 PS> ./check-admin.ps1
✅ Yes ✅ Yes, Markus has admin rights.
``` ```
@ -39,7 +39,7 @@ Script Content
This PowerShell script checks if the user has administrator rights. This PowerShell script checks if the user has administrator rights.
.EXAMPLE .EXAMPLE
PS> ./check-admin.ps1 PS> ./check-admin.ps1
✅ Yes ✅ Yes, Markus has admin rights.
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -53,18 +53,18 @@ try {
$user = [Security.Principal.WindowsIdentity]::GetCurrent() $user = [Security.Principal.WindowsIdentity]::GetCurrent()
$principal = (New-Object Security.Principal.WindowsPrincipal $user) $principal = (New-Object Security.Principal.WindowsPrincipal $user)
if ($principal.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)) { if ($principal.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)) {
"✅ Yes" "✅ Yes, $USERNAME has admin rights."
} elseif ($principal.IsInRole([Security.Principal.WindowsBuiltinRole]::Guest)) { } elseif ($principal.IsInRole([Security.Principal.WindowsBuiltinRole]::Guest)) {
"⚠️ No, guest rights only" "⚠️ No, $USERNAME, has guest rights only."
} else { } else {
"⚠️ No, normal user rights only" "⚠️ No, $USERNAME has normal user rights only."
} }
} }
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error: $($Error[0]) (in script line $($_.InvocationInfo.ScriptLineNumber))"
exit 1 exit 1
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-admin.ps1 as of 05/19/2024 10:25:17)* *(generated by convert-ps2md.ps1 using the comment-based help of check-admin.ps1 as of 08/15/2024 09:50:45)*

View File

@ -65,7 +65,7 @@ try {
$statusMsg += ", $numUpdates upgrades available" $statusMsg += ", $numUpdates upgrades available"
$crashDumps = GetCrashDumps $crashDumps = GetCrashDumps
if ($crashDumps -ne 0) { $statusIcon = "⚠️"; $statusMsg += ", $crashDumps crash dumps found" } if ($crashDumps -ne 0) { $statusIcon = "⚠️"; $statusMsg += " - found $crashDumps crash dump(s)" }
} }
Write-Host "$statusIcon $statusMsg" Write-Host "$statusIcon $statusMsg"
exit 0 # success exit 0 # success
@ -75,4 +75,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-apps.ps1 as of 05/19/2024 10:25:17)* *(generated by convert-ps2md.ps1 using the comment-based help of check-apps.ps1 as of 08/15/2024 09:50:45)*

View File

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

View File

@ -61,7 +61,7 @@ function GetCPUTemperature {
} }
try { try {
Write-Progress "Querying CPU status... " Write-Progress "Querying CPU status..."
$status = "✅" $status = "✅"
$arch = GetCPUArchitecture $arch = GetCPUArchitecture
if ($IsLinux) { if ($IsLinux) {
@ -76,24 +76,24 @@ try {
$arch = "$arch, " $arch = "$arch, "
$deviceID = "$($details.DeviceID), " $deviceID = "$($details.DeviceID), "
$speed = "$($details.MaxClockSpeed)MHz, " $speed = "$($details.MaxClockSpeed)MHz, "
$socket = "$($details.SocketDesignation) socket, " $socket = "$($details.SocketDesignation) socket"
} }
$cores = [System.Environment]::ProcessorCount $cores = [System.Environment]::ProcessorCount
$celsius = GetCPUTemperature $celsius = GetCPUTemperature
if ($celsius -eq 99999.9) { if ($celsius -eq 99999.9) {
$temp = "no temp" $temp = "no temp"
} elseif ($celsius -gt 50) { } elseif ($celsius -gt 50) {
$temp = "$($celsius)°C" $temp = "$($celsius)°C HOT"
$status = "⚠️" $status = "⚠️"
} elseif ($celsius -lt 0) { } elseif ($celsius -lt 0) {
$temp = "$($celsius)°C" $temp = "$($celsius)°C COLD"
$status = "⚠️" $status = "⚠️"
} else { } else {
$temp = "$($celsius)°C" $temp = "$($celsius)°C OK"
} }
Write-Progress -completed "Done." Write-Progress -completed "Done."
Write-Host "$status $cpuName ($($arch)$cores cores, $($deviceID)$($speed)$($socket)$temp)" Write-Host "$status $cpuName ($($arch)$cores cores, $($deviceID)$($speed)$($socket)) - $temp"
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 check-cpu.ps1 as of 05/19/2024 10:25:17)* *(generated by convert-ps2md.ps1 using the comment-based help of check-cpu.ps1 as of 08/15/2024 09:50:45)*

View File

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

View File

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

View File

@ -47,7 +47,7 @@ Script Content
#> #>
try { try {
Write-Progress "Measuring DNS resolution..." #Write-Progress "Measuring DNS resolution..."
$table = Import-CSV "$PSScriptRoot/../data/popular-domains.csv" $table = Import-CSV "$PSScriptRoot/../data/popular-domains.csv"
$numRows = $table.Length $numRows = $table.Length
@ -59,7 +59,7 @@ try {
} }
[float]$elapsed = $stopWatch.Elapsed.TotalSeconds [float]$elapsed = $stopWatch.Elapsed.TotalSeconds
Write-Progress -completed " " #Write-Progress -completed "Measuring DNS resolution..."
$average = [math]::round($numRows / $elapsed, 1) $average = [math]::round($numRows / $elapsed, 1)
if ($average -lt 10.0) { if ($average -lt 10.0) {
Write-Host "⚠️ DNS resolves $average domains per second only" Write-Host "⚠️ DNS resolves $average domains per second only"
@ -73,4 +73,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-dns.ps1 as of 05/19/2024 10:25:17)* *(generated by convert-ps2md.ps1 using the comment-based help of check-dns.ps1 as of 08/15/2024 09:50:45)*

View File

@ -35,7 +35,7 @@ Example
------- -------
```powershell ```powershell
PS> ./check-drive-space.ps1 C PS> ./check-drive-space.ps1 C
✅ Drive C: has 442GB free (56% of 1TB used) ✅ Drive C: uses 56% of 1TB - 442GB free
``` ```
@ -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: has 442GB free (56% of 1TB used) ✅ Drive C: uses 56% of 1TB - 442GB free
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -101,7 +101,7 @@ try {
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 {
[int64]$percent = ($used * 100) / $total [int64]$percent = ($used * 100) / $total
Write-Host "✅ Drive $driveName has $(Bytes2String $free) free ($percent% of $(Bytes2String $total) used)" Write-Host "✅ Drive $driveName uses $percent% of $(Bytes2String $total) - $(Bytes2String $free) free"
} }
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 05/19/2024 10:25:17)* *(generated by convert-ps2md.ps1 using the comment-based help of check-drive-space.ps1 as of 08/15/2024 09:50:45)*

View File

@ -26,8 +26,8 @@ Example
------- -------
```powershell ```powershell
PS> ./check-drives.ps1 PS> ./check-drives.ps1
✅ Drive C: has 512GB free (49% of 1TB used) ✅ Drive C: uses 49% of 1TB - 512GB free
✅ Drive D: has 641GB free (84% of 4TB used) ✅ Drive D: uses 84% of 4TB - 641GB free
``` ```
@ -51,8 +51,8 @@ Script Content
Specifies the minimum warning level (10GB by default) Specifies the minimum warning level (10GB by default)
.EXAMPLE .EXAMPLE
PS> ./check-drives.ps1 PS> ./check-drives.ps1
✅ Drive C: has 512GB free (49% of 1TB used) ✅ Drive C: uses 49% of 1TB - 512GB free
✅ Drive D: has 641GB free (84% of 4TB used) ✅ Drive D: uses 84% of 4TB - 641GB free
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -90,7 +90,7 @@ try {
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 {
[int64]$percent = ($used * 100) / $total [int64]$percent = ($used * 100) / $total
Write-Host "✅ Drive $name has $(Bytes2String $free) free ($percent% of $(Bytes2String $total) used)" Write-Host "✅ Drive $name uses $percent% of $(Bytes2String $total) - $(Bytes2String $free) free"
} }
} }
exit 0 # success exit 0 # success
@ -100,4 +100,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-drives.ps1 as of 05/19/2024 10:25:17)* *(generated by convert-ps2md.ps1 using the comment-based help of check-drives.ps1 as of 08/15/2024 09:50:45)*

View File

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

View File

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

View File

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

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 05/19/2024 10:25:17)* *(generated by convert-ps2md.ps1 using the comment-based help of check-file.ps1 as of 08/15/2024 09:50:45)*

View File

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

View File

@ -24,7 +24,7 @@ Script Content
This PowerShell script queries the GPU status and prints it. This PowerShell script queries the GPU status and prints it.
.EXAMPLE .EXAMPLE
PS> ./check-gpu.ps1 PS> ./check-gpu.ps1
✅ NVIDIA Quadro P400 GPU (2GB RAM, 3840x2160 pixels, 32-bit, 59Hz, driver 31.0.15.1740, status OK) ✅ NVIDIA Quadro P400 GPU (2GB RAM, 3840x2160 pixels, 32-bit, 59Hz, driver 31.0.15.1740) - status OK
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -56,7 +56,7 @@ try {
$RefreshRate = $Details.CurrentRefreshRate $RefreshRate = $Details.CurrentRefreshRate
$DriverVersion = $Details.DriverVersion $DriverVersion = $Details.DriverVersion
$Status = $Details.Status $Status = $Details.Status
Write-Host "✅ $Model GPU ($(Bytes2String $RAMSize) RAM, $($ResWidth)x$($ResHeight) pixels, $($BitsPerPixel)-bit, $($RefreshRate)Hz, driver $DriverVersion, status $Status)" Write-Host "✅ $Model GPU ($(Bytes2String $RAMSize) RAM, $($ResWidth)x$($ResHeight) pixels, $($BitsPerPixel)-bit, $($RefreshRate)Hz, driver $DriverVersion) - status $Status"
} }
exit 0 # success exit 0 # success
} catch { } catch {
@ -65,4 +65,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-gpu.ps1 as of 05/19/2024 10:25:17)* *(generated by convert-ps2md.ps1 using the comment-based help of check-gpu.ps1 as of 08/15/2024 09:50:45)*

View File

@ -63,4 +63,4 @@ Write-Host "`n H A R D W A R E" -foregroundColor green
exit 0 # success exit 0 # success
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-hardware.ps1 as of 05/19/2024 10:25:17)* *(generated by convert-ps2md.ps1 using the comment-based help of check-hardware.ps1 as of 08/15/2024 09:50:45)*

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 05/19/2024 10:25:17)* *(generated by convert-ps2md.ps1 using the comment-based help of check-health.ps1 as of 08/15/2024 09:50:45)*

View File

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

View File

@ -84,4 +84,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-ipv4-address.ps1 as of 05/19/2024 10:25:18)* *(generated by convert-ps2md.ps1 using the comment-based help of check-ipv4-address.ps1 as of 08/15/2024 09:50:45)*

View File

@ -98,4 +98,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-ipv6-address.ps1 as of 05/19/2024 10:25:18)* *(generated by convert-ps2md.ps1 using the comment-based help of check-ipv6-address.ps1 as of 08/15/2024 09:50:45)*

View File

@ -55,4 +55,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-iss-position.ps1 as of 05/19/2024 10:25:18)* *(generated by convert-ps2md.ps1 using the comment-based help of check-iss-position.ps1 as of 08/15/2024 09:50:45)*

View File

@ -87,4 +87,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-mac-address.ps1 as of 05/19/2024 10:25:18)* *(generated by convert-ps2md.ps1 using the comment-based help of check-mac-address.ps1 as of 08/15/2024 09:50:45)*

View File

@ -60,4 +60,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-midnight.ps1 as of 05/19/2024 10:25:18)* *(generated by convert-ps2md.ps1 using the comment-based help of check-midnight.ps1 as of 08/15/2024 09:50:45)*

View File

@ -57,4 +57,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-month.ps1 as of 05/19/2024 10:25:18)* *(generated by convert-ps2md.ps1 using the comment-based help of check-month.ps1 as of 08/15/2024 09:50:45)*

View File

@ -76,4 +76,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-moon-phase.ps1 as of 05/19/2024 10:25:18)* *(generated by convert-ps2md.ps1 using the comment-based help of check-moon-phase.ps1 as of 08/15/2024 09:50:45)*

View File

@ -55,13 +55,13 @@ Script Content
#> #>
Write-Host "`n N E T W O R K" -foregroundColor green Write-Host "`n N E T W O R K" -foregroundColor green
& "$PSScriptRoot/list-ip-addresses.ps1"
& "$PSScriptRoot/ping-remote-hosts.ps1" & "$PSScriptRoot/ping-remote-hosts.ps1"
& "$PSScriptRoot/check-firewall" & "$PSScriptRoot/check-firewall"
& "$PSScriptRoot/check-dns.ps1" & "$PSScriptRoot/check-dns.ps1"
& "$PSScriptRoot/check-vpn.ps1" & "$PSScriptRoot/check-vpn.ps1"
& "$PSScriptRoot/list-public-ip.ps1"
& "$PSScriptRoot/ping-local-hosts.ps1" & "$PSScriptRoot/ping-local-hosts.ps1"
exit 0 # success exit 0 # success
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-network.ps1 as of 05/19/2024 10:25:18)* *(generated by convert-ps2md.ps1 using the comment-based help of check-network.ps1 as of 08/15/2024 09:50:45)*

View File

@ -59,4 +59,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-noon.ps1 as of 05/19/2024 10:25:18)* *(generated by convert-ps2md.ps1 using the comment-based help of check-noon.ps1 as of 08/15/2024 09:50:46)*

View File

@ -73,4 +73,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-os.ps1 as of 05/19/2024 10:25:18)* *(generated by convert-ps2md.ps1 using the comment-based help of check-os.ps1 as of 08/15/2024 09:50:46)*

View File

@ -65,4 +65,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-outlook.ps1 as of 05/19/2024 10:25:18)* *(generated by convert-ps2md.ps1 using the comment-based help of check-outlook.ps1 as of 08/15/2024 09:50:46)*

View File

@ -94,4 +94,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-password.ps1 as of 05/19/2024 10:25:18)* *(generated by convert-ps2md.ps1 using the comment-based help of check-password.ps1 as of 08/15/2024 09:50:46)*

View File

@ -92,4 +92,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-pending-reboot.ps1 as of 05/19/2024 10:25:18)* *(generated by convert-ps2md.ps1 using the comment-based help of check-pending-reboot.ps1 as of 08/15/2024 09:50:46)*

68
docs/check-pnp-devices.md Normal file
View File

@ -0,0 +1,68 @@
Script: *check-pnp-devices.ps1*
========================
This PowerShell script checks all Plug'n'PLay devices connected to the local computer.
Parameters
----------
```powershell
PS> ./check-pnp-devices.ps1 [<CommonParameters>]
[<CommonParameters>]
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
```
Example
-------
```powershell
PS> ./check-pnp-devices.ps1
FriendlyName Status InstanceId
------------ ------ ----------
Microsoft-Controller OK ROOT\SPACEPORT\0000
...
```
Notes
-----
Author: Markus Fleschutz | License: CC0
Related Links
-------------
https://github.com/fleschutz/PowerShell
Script Content
--------------
```powershell
<#
.SYNOPSIS
Checks PnP devices
.DESCRIPTION
This PowerShell script checks all Plug'n'PLay devices connected to the local computer.
.EXAMPLE
PS> ./check-pnp-devices.ps1
FriendlyName Status InstanceId
------------ ------ ----------
Microsoft-Controller OK ROOT\SPACEPORT\0000
...
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
Get-PnpDevice | Where-Object {$_.Status -like "Error"} | Format-Table -property FriendlyName,Status,InstanceId
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}
```
*(generated by convert-ps2md.ps1 using the comment-based help of check-pnp-devices.ps1 as of 08/15/2024 09:50:46)*

View File

@ -17,7 +17,7 @@ Example
------- -------
```powershell ```powershell
PS> ./check-power.ps1 PS> ./check-power.ps1
⚠️ Battery at 9% · 54 min remaining · power scheme 'HP Optimized' ⚠️ Battery at 9% with 54min remaining · power scheme 'HP Optimized'
``` ```
@ -39,7 +39,7 @@ Script Content
This PowerShell script queries the power status and prints it. This PowerShell script queries the power status and prints it.
.EXAMPLE .EXAMPLE
PS> ./check-power.ps1 PS> ./check-power.ps1
⚠️ Battery at 9% · 54 min remaining · power scheme 'HP Optimized' ⚠️ Battery at 9% with 54min remaining · power scheme 'HP Optimized'
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -68,23 +68,23 @@ try {
} elseif ($remaining -eq 0) { } elseif ($remaining -eq 0) {
$reply = "✅ Battery at $percent%" $reply = "✅ Battery at $percent%"
} elseif ($remaining -le 5) { } elseif ($remaining -le 5) {
$reply = "⚠️ Battery at $percent% · ONLY $($remaining)min remaining" $reply = "⚠️ Battery at $percent% with ONLY $($remaining)min remaining"
} elseif ($remaining -le 30) { } elseif ($remaining -le 30) {
$reply = "⚠️ Battery at $percent% · only $($remaining)min remaining" $reply = "⚠️ Battery at $percent% with only $($remaining)min remaining"
} elseif ($percent -lt 10) { } elseif ($percent -lt 10) {
$reply = "⚠️ Battery at $percent% · $($remaining)min remaining" $reply = "⚠️ Battery at $percent% with $($remaining)min remaining"
} elseif ($percent -ge 60) { } elseif ($percent -ge 80) {
$reply = "✅ Battery $percent% full · $($remaining)min remaining" $reply = "✅ Battery $percent% full with $($remaining)min remaining"
} else { } else {
$reply = "✅ Battery at $percent% · $($remaining)min remaining" $reply = "✅ Battery at $percent% with $($remaining)min remaining"
} }
} }
$powerScheme = (powercfg /getactivescheme) $powerScheme = (powercfg /getactivescheme)
$powerScheme = $powerScheme -Replace "^(.*) \(","" $powerScheme = $powerScheme -Replace "^(.*) \(",""
$powerScheme = $powerScheme -Replace "\)$","" $powerScheme = $powerScheme -Replace "\)$",""
$reply += " · power scheme '$powerScheme'" $reply += ", power scheme is '$powerScheme'"
} }
Write-Output $reply Write-Host $reply
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
@ -92,4 +92,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-power.ps1 as of 05/19/2024 10:25:18)* *(generated by convert-ps2md.ps1 using the comment-based help of check-power.ps1 as of 08/15/2024 09:50:46)*

View File

@ -59,4 +59,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-powershell.ps1 as of 05/19/2024 10:25:18)* *(generated by convert-ps2md.ps1 using the comment-based help of check-powershell.ps1 as of 08/15/2024 09:50:46)*

View File

@ -76,4 +76,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-ps1-file.ps1 as of 05/19/2024 10:25:18)* *(generated by convert-ps2md.ps1 using the comment-based help of check-ps1-file.ps1 as of 08/15/2024 09:50:46)*

View File

@ -24,7 +24,7 @@ Script Content
This PowerShell script queries the status of the installed RAM memory modules and prints it. This PowerShell script queries the status of the installed RAM memory modules and prints it.
.EXAMPLE .EXAMPLE
PS> ./check-ram.ps1 PS> ./check-ram.ps1
✅ 16GB DDR4 RAM @ 3200MHz by Micron (in CPU0/CPU0-DIMM3 @ 1.2V) ✅ 16GB DDR4 RAM at 3200MHz/1.2V in CPU0/CPU0-DIMM3 by Micron
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -88,7 +88,7 @@ try {
[float]$Voltage = $Bank.ConfiguredVoltage / 1000.0 [float]$Voltage = $Bank.ConfiguredVoltage / 1000.0
$Manufacturer = $Bank.Manufacturer $Manufacturer = $Bank.Manufacturer
$Location = "$($Bank.BankLabel)/$($Bank.DeviceLocator)" $Location = "$($Bank.BankLabel)/$($Bank.DeviceLocator)"
Write-Host "✅ $Capacity $Type @ $($Speed)MHz by $Manufacturer (in $Location @ $($Voltage)V)" Write-Host "✅ $Capacity $Type at $($Speed)MHz,$($Voltage)V in $Location by $Manufacturer"
} }
} }
exit 0 # success exit 0 # success
@ -98,4 +98,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-ram.ps1 as of 05/19/2024 10:25:18)* *(generated by convert-ps2md.ps1 using the comment-based help of check-ram.ps1 as of 08/15/2024 09:50:46)*

View File

@ -27,7 +27,7 @@ Example
```powershell ```powershell
PS> ./check-repo.ps1 C:\MyRepo PS> ./check-repo.ps1 C:\MyRepo
⏳ (1/10) Searching for Git executable... git version 2.41.0.windows.3 ⏳ (1/10) Searching for Git executable... git version 2.41.0.windows.3
⏳ (2/10) Checking local repository... 📂C:\MyRepo ⏳ (2/10) Checking local repository... C:\MyRepo
⏳ (3/10) Querying remote URL... git@github.com:fleschutz/PowerShell.git ⏳ (3/10) Querying remote URL... git@github.com:fleschutz/PowerShell.git
⏳ (4/10) Querying current branch... main ⏳ (4/10) Querying current branch... main
⏳ (5/10) Fetching remote updates... OK ⏳ (5/10) Fetching remote updates... OK
@ -58,7 +58,7 @@ Script Content
.EXAMPLE .EXAMPLE
PS> ./check-repo.ps1 C:\MyRepo PS> ./check-repo.ps1 C:\MyRepo
⏳ (1/10) Searching for Git executable... git version 2.41.0.windows.3 ⏳ (1/10) Searching for Git executable... git version 2.41.0.windows.3
⏳ (2/10) Checking local repository... 📂C:\MyRepo ⏳ (2/10) Checking local repository... C:\MyRepo
⏳ (3/10) Querying remote URL... git@github.com:fleschutz/PowerShell.git ⏳ (3/10) Querying remote URL... git@github.com:fleschutz/PowerShell.git
⏳ (4/10) Querying current branch... main ⏳ (4/10) Querying current branch... main
⏳ (5/10) Fetching remote updates... OK ⏳ (5/10) Fetching remote updates... OK
@ -83,7 +83,7 @@ try {
Write-Host "⏳ (2/10) Checking local repository... " -noNewline Write-Host "⏳ (2/10) Checking local repository... " -noNewline
$FullPath = Resolve-Path "$pathToRepo" $FullPath = Resolve-Path "$pathToRepo"
if (!(Test-Path "$FullPath" -pathType Container)) { throw "Can't access folder: $FullPath" } if (!(Test-Path "$FullPath" -pathType Container)) { throw "Can't access folder: $FullPath" }
"📂$FullPath" "$FullPath"
Write-Host "⏳ (3/10) Querying remote URL... " -noNewline Write-Host "⏳ (3/10) Querying remote URL... " -noNewline
& git -C "$FullPath" remote get-url origin & git -C "$FullPath" remote get-url origin
@ -121,7 +121,7 @@ try {
$repoDirName = (Get-Item "$FullPath").Name $repoDirName = (Get-Item "$FullPath").Name
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds [int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✔️ Checked repo 📂$repoDirName in $($elapsed)s." "✔️ Checked 📂$repoDirName repo in $($elapsed)s."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
@ -129,4 +129,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-repo.ps1 as of 05/19/2024 10:25:18)* *(generated by convert-ps2md.ps1 using the comment-based help of check-repo.ps1 as of 08/15/2024 09:50:46)*

View File

@ -91,4 +91,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-repos.ps1 as of 05/19/2024 10:25:18)* *(generated by convert-ps2md.ps1 using the comment-based help of check-repos.ps1 as of 08/15/2024 09:50:46)*

View File

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

View File

@ -24,7 +24,7 @@ Script Content
This PowerShell script queries the status of the SSD/HDD devices (supporting S.M.A.R.T.) and prints it. This PowerShell script queries the status of the SSD/HDD devices (supporting S.M.A.R.T.) and prints it.
.EXAMPLE .EXAMPLE
PS> ./check-smart-devices.ps1 PS> ./check-smart-devices.ps1
✅ 1TB Samsung SSD 970 EVO via NVMe (37°C, 2388 hours, 289x on/off, v2B2QEXE7, selftest passed) ✅ 1TB Samsung SSD 970 EVO via NVMe (37°C, 2388 hours, 289x on/off, v2B2QEXE7) - selftest OK
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -48,18 +48,18 @@ function Bytes2String([int64]$bytes) {
} }
try { try {
Write-Progress "(1/3) Searching for smartmontools..." #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" } 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..." #Write-Progress "(2/3) Scanning S.M.A.R.T devices..."
if ($IsLinux) { if ($IsLinux) {
$devices = $(sudo smartctl --scan-open) $devices = $(sudo smartctl --scan-open)
} else { } else {
$devices = $(smartctl --scan-open) $devices = $(smartctl --scan-open)
} }
Write-Progress "(3/3) Querying S.M.A.R.T devices..." #Write-Progress "Querying S.M.A.R.T devices..."
foreach($device in $devices) { foreach($device in $devices) {
$array = $device.split(" ") $array = $device.split(" ")
$dev = $array[0] $dev = $array[0]
@ -100,15 +100,15 @@ try {
$powerOn = "$($details.power_cycle_count)x on/off" $powerOn = "$($details.power_cycle_count)x on/off"
} }
if ($details.smart_status.passed) { if ($details.smart_status.passed) {
$selftest = "selftest passed" $selftest = "selftest OK"
} else { } else {
$selftest = "selftest FAILED" $selftest = "selftest FAILED"
$status = "⚠️" $status = "⚠️"
} }
$firmwareVersion = $details.firmware_version $firmwareVersion = $details.firmware_version
Write-Host "$status $capacity$modelName via $protocol ($temp, $hours, $powerOn, $selftest, v$firmwareVersion)" Write-Host "$status $capacity$modelName via $protocol ($temp, $hours, $powerOn, v$firmwareVersion) - $selftest"
} }
Write-Progress -completed " " #Write-Progress -completed "Done."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
@ -116,4 +116,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-smart-devices.ps1 as of 05/19/2024 10:25:18)* *(generated by convert-ps2md.ps1 using the comment-based help of check-smart-devices.ps1 as of 08/15/2024 09:50:46)*

View File

@ -65,4 +65,4 @@ Write-Host "`n S O F T W A R E" -foregroundColor green
exit 0 # success exit 0 # success
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-software.ps1 as of 05/19/2024 10:25:18)* *(generated by convert-ps2md.ps1 using the comment-based help of check-software.ps1 as of 08/15/2024 09:50:46)*

View File

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

View File

@ -9,7 +9,7 @@ Parameters
PS> ./check-swap-space.ps1 [[-minLevel] <Int32>] [<CommonParameters>] PS> ./check-swap-space.ps1 [[-minLevel] <Int32>] [<CommonParameters>]
-minLevel <Int32> -minLevel <Int32>
Specifies the minimum level in GB (10 GB by default) Specifies the minimum level in MB (10 MB by default)
Required? false Required? false
Position? 1 Position? 1
@ -26,7 +26,7 @@ Example
------- -------
```powershell ```powershell
PS> ./check-swap-space.ps1 PS> ./check-swap-space.ps1
✅ Swap space has 748MB free (42% of 1GB used) ✅ Swap space uses 21% of 1GB - 1005MB free
``` ```
@ -47,10 +47,10 @@ Script Content
.DESCRIPTION .DESCRIPTION
This PowerShell script queries the current status of the swap space and prints it. This PowerShell script queries the current status of the swap space and prints it.
.PARAMETER minLevel .PARAMETER minLevel
Specifies the minimum level in GB (10 GB by default) Specifies the minimum level in MB (10 MB by default)
.EXAMPLE .EXAMPLE
PS> ./check-swap-space.ps1 PS> ./check-swap-space.ps1
✅ Swap space has 748MB free (42% of 1GB used) ✅ Swap space uses 21% of 1GB - 1005MB free
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -60,15 +60,15 @@ 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 1024) { return "$($bytes)MB" }
$bytes /= 1000 $bytes /= 1024
if ($bytes -lt 1000) { return "$($bytes)GB" } if ($bytes -lt 1024) { return "$($bytes)GB" }
$bytes /= 1000 $bytes /= 1024
if ($bytes -lt 1000) { return "$($bytes)TB" } if ($bytes -lt 1024) { return "$($bytes)TB" }
$bytes /= 1000 $bytes /= 1024
if ($bytes -lt 1000) { return "$($bytes)PB" } if ($bytes -lt 1024) { return "$($bytes)PB" }
$bytes /= 1000 $bytes /= 1024
if ($bytes -lt 1000) { return "$($bytes)EB" } if ($bytes -lt 1024) { return "$($bytes)EB" }
} }
try { try {
@ -94,11 +94,11 @@ try {
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 has only $(MB2String $free) of $(MB2String $total) free" Write-Output "⚠️ Swap space has only $(MB2String $free) of $(MB2String $total) free"
} elseif ($used -lt 5) { } elseif ($used -lt 3) {
Write-Output "✅ Swap space has all $(MB2String $free) free" Write-Output "✅ Swap space unused - full $(MB2String $free) free"
} else { } else {
[int64]$percent = ($used * 100) / $total [int64]$percent = ($used * 100) / $total
Write-Output "✅ Swap space has $(MB2String $free) free ($percent% of $(MB2String $total) used)" Write-Output "✅ Swap space at $percent% of $(MB2String $total) - $(MB2String $free) free"
} }
exit 0 # success exit 0 # success
} catch { } catch {
@ -107,4 +107,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-swap-space.ps1 as of 05/19/2024 10:25:18)* *(generated by convert-ps2md.ps1 using the comment-based help of check-swap-space.ps1 as of 08/15/2024 09:50:46)*

View File

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

View File

@ -1,7 +1,7 @@
Script: *check-time-zone.ps1* Script: *check-time-zone.ps1*
======================== ========================
This PowerShell script queries the time zone and prints it. This PowerShell script queries the local time zone and prints it.
Parameters Parameters
---------- ----------
@ -17,7 +17,7 @@ Example
------- -------
```powershell ```powershell
PS> ./check-time-zone.ps1 PS> ./check-time-zone.ps1
11:13 AM W. Europe Summer Time (UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna (+01:00 DST) 3:27 PM in W. Europe Summer Time (UTC+01:00:00 +1h DST)
``` ```
@ -36,10 +36,10 @@ Script Content
.SYNOPSIS .SYNOPSIS
Checks the time zone Checks the time zone
.DESCRIPTION .DESCRIPTION
This PowerShell script queries the time zone and prints it. This PowerShell script queries the local time zone and prints it.
.EXAMPLE .EXAMPLE
PS> ./check-time-zone.ps1 PS> ./check-time-zone.ps1
11:13 AM W. Europe Summer Time (UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna (+01:00 DST) 3:27 PM in W. Europe Summer Time (UTC+01:00:00 +1h DST)
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -50,14 +50,15 @@ try {
[system.threading.thread]::currentThread.currentCulture = [system.globalization.cultureInfo]"en-US" [system.threading.thread]::currentThread.currentCulture = [system.globalization.cultureInfo]"en-US"
$Time = $((Get-Date).ToShortTimeString()) $Time = $((Get-Date).ToShortTimeString())
$TZ = (Get-Timezone) $TZ = (Get-Timezone)
$offset = $TZ.BaseUtcOffset
if ($TZ.SupportsDaylightSavingTime) { if ($TZ.SupportsDaylightSavingTime) {
$TZName = $TZ.DaylightName $TZName = $TZ.DaylightName
$DST=" (+01:00 DST)" $DST=" +1h DST"
} else { } else {
$TZName = $TZ.StandardName $TZName = $TZ.StandardName
$DST="" $DST=""
} }
Write-Host "✅ $Time $TZName $($TZ.DisplayName)$($DST)" Write-Host "✅ $Time in $TZName (UTC+$($offset)$($DST))"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
@ -65,4 +66,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-time-zone.ps1 as of 05/19/2024 10:25:18)* *(generated by convert-ps2md.ps1 using the comment-based help of check-time-zone.ps1 as of 08/15/2024 09:50:46)*

View File

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

View File

@ -65,4 +65,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of check-vpn.ps1 as of 05/19/2024 10:25:18)* *(generated by convert-ps2md.ps1 using the comment-based help of check-vpn.ps1 as of 08/15/2024 09:50:46)*

View File

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

View File

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

View File

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

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

View File

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

View File

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

View File

@ -7,10 +7,10 @@ NOTE: To be used with care! This cannot be undone!
Parameters Parameters
---------- ----------
```powershell ```powershell
PS> ./clean-repo.ps1 [[-pathToRepo] <String>] [<CommonParameters>] PS> ./clean-repo.ps1 [[-path] <String>] [<CommonParameters>]
-pathToRepo <String> -path <String>
Specifies the file path to the local Git repository Specifies the file path to the local Git repository (current working directory by default)
Required? false Required? false
Position? 1 Position? 1
@ -26,12 +26,12 @@ PS> ./clean-repo.ps1 [[-pathToRepo] <String>] [<CommonParameters>]
Example Example
------- -------
```powershell ```powershell
PS> ./clean-repo.ps1 C:\rust PS> ./clean-repo.ps1 C:\Repos\rust
⏳ (1/4) Searching for Git executable... git version 2.41.0.windows.3 ⏳ (1/4) Searching for Git executable... git version 2.45.0
⏳ (2/4) Checking local repository... 📂C:\rust ⏳ (2/4) Checking local repository... C:\Repos\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...
✔️ Repo 📂rust is clean now (took 1s). ✔️ Cleaned up 📂rust repository in 2s.
``` ```
@ -52,22 +52,22 @@ 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 pathToRepo .PARAMETER path
Specifies the file path to the local Git repository Specifies the file path to the local Git repository (current working directory by default)
.EXAMPLE .EXAMPLE
PS> ./clean-repo.ps1 C:\rust PS> ./clean-repo.ps1 C:\Repos\rust
⏳ (1/4) Searching for Git executable... git version 2.41.0.windows.3 ⏳ (1/4) Searching for Git executable... git version 2.45.0
⏳ (2/4) Checking local repository... 📂C:\rust ⏳ (2/4) Checking local repository... C:\Repos\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...
✔️ Repo 📂rust is clean now (took 1s). ✔️ Cleaned up 📂rust repository in 2s.
.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]$pathToRepo = "$PWD") param([string]$path = "$PWD")
try { try {
$stopWatch = [system.diagnostics.stopwatch]::startNew() $stopWatch = [system.diagnostics.stopwatch]::startNew()
@ -76,24 +76,24 @@ try {
& git --version & git --version
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" } if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
"⏳ (2/4) Checking local repository... 📂$pathToRepo" "⏳ (2/4) Checking local repository... $path"
if (-not(Test-Path "$pathToRepo" -pathType container)) { throw "Can't access repo folder '$pathToRepo' - maybe a typo or missing folder permissions?" } if (-not(Test-Path "$path" -pathType container)) { throw "Can't access repo folder '$path' - maybe a typo or missing folder permissions?" }
$repoName = (Get-Item "$pathToRepo").Name $repoName = (Get-Item "$path").Name
"⏳ (3/4) Removing untracked files in repository..." "⏳ (3/4) Removing untracked files in repository..."
& git -C "$pathToRepo" clean -xfd -f # to delete all untracked files in the main repo & git -C "$path" 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 "$pathToRepo" clean -xfd -f & git -C "$path" 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 "$pathToRepo" submodule foreach --recursive git clean -xfd -f # to delete all untracked files in the submodules & git -C "$path" 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
"✔️ Repo 📂$repoName is clean now (took $($elapsed)s)." "✔️ Cleaned up 📂$repoName repository in $($elapsed)s."
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 05/19/2024 10:25:18)* *(generated by convert-ps2md.ps1 using the comment-based help of clean-repo.ps1 as of 08/15/2024 09:50:46)*

View File

@ -100,4 +100,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of clean-repos.ps1 as of 05/19/2024 10:25:19)* *(generated by convert-ps2md.ps1 using the comment-based help of clean-repos.ps1 as of 08/15/2024 09:50:46)*

View File

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

View File

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

View File

@ -27,7 +27,7 @@ Example
```powershell ```powershell
PS> ./clone-repos C:\MyRepos PS> ./clone-repos C:\MyRepos
... ...
✔️ Cloned 29 of 29 Git repos into 📂MyRepos in 123 sec ✔️ Cloned 29 additional Git repos into 📂MyRepos in 123s.
``` ```
@ -52,7 +52,7 @@ Script Content
.EXAMPLE .EXAMPLE
PS> ./clone-repos C:\MyRepos PS> ./clone-repos C:\MyRepos
... ...
✔️ Cloned 29 of 29 Git repos into 📂MyRepos in 123 sec ✔️ Cloned 29 additional Git repos into 📂MyRepos in 123s.
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -68,8 +68,8 @@ try {
& git --version & git --version
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" } if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
Write-Host "⏳ (2) Reading data/popular-repositories.csv... " -noNewline Write-Host "⏳ (2) Reading data/popular-repos.csv... " -noNewline
$table = Import-CSV "$PSScriptRoot/../data/popular-repositories.csv" $table = Import-CSV "$PSScriptRoot/../data/popular-repos.csv"
$total = $table.count $total = $table.count
Write-Host "$total repos" Write-Host "$total repos"
@ -89,22 +89,22 @@ try {
$step++ $step++
if (Test-Path "$targetDir/$folderName" -pathType container) { if (Test-Path "$targetDir/$folderName" -pathType container) {
"⏳ ($step/$($total + 4)) Skipping existing 📂$folderName (a $category)..." "⏳ ($step/$($total + 3)) Skipping 📂$folderName - the $category exists already..."
$skipped++ $skipped++
} elseif ($shallow -eq "yes") { } elseif ($shallow -eq "yes") {
"⏳ ($step/$($total + 4)) Cloning into 📂$folderName (a $category, $branch branch, shallow)..." "⏳ ($step/$($total + 3)) Cloning into 📂$folderName (a $category, $branch branch, shallow)..."
& git clone --branch "$branch" --single-branch --recurse-submodules "$URL" "$targetDir/$folderName" & git clone --branch "$branch" --single-branch --recurse-submodules "$URL" "$targetDir/$folderName"
if ($lastExitCode -ne "0") { throw "'git clone --branch $branch $URL' failed with exit code $lastExitCode" } if ($lastExitCode -ne "0") { throw "'git clone --branch $branch $URL' failed with exit code $lastExitCode" }
$cloned++ $cloned++
} else { } else {
"⏳ ($step/$($total + 4)) Cloning into 📂$folderName (a $category, $branch branch, full history)..." "⏳ ($step/$($total + 3)) Cloning into 📂$folderName (a $category, $branch branch, full history)..."
& git clone --branch "$branch" --recurse-submodules "$URL" "$targetDir/$folderName" & git clone --branch "$branch" --recurse-submodules "$URL" "$targetDir/$folderName"
if ($lastExitCode -ne "0") { throw "'git clone --branch $branch $URL' failed with exit code $lastExitCode" } if ($lastExitCode -ne "0") { throw "'git clone --branch $branch $URL' failed with exit code $lastExitCode" }
$clone++ $clone++
} }
} }
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds [int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✔️ Cloned $cloned of $total Git repos into 📂$targetDirName in $elapsed sec" "✔️ Cloned $cloned additional Git repos into 📂$targetDirName in $($elapsed)s."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
@ -112,4 +112,4 @@ try {
} }
``` ```
*(generated by convert-ps2md.ps1 using the comment-based help of clone-repos.ps1 as of 05/19/2024 10:25:19)* *(generated by convert-ps2md.ps1 using the comment-based help of clone-repos.ps1 as of 08/15/2024 09:50:46)*

77
docs/clone-shallow.md Normal file
View File

@ -0,0 +1,77 @@
Script: *clone-shallow.ps1*
========================
This PowerShell script clones popular Git repositories into a common target directory.
Parameters
----------
```powershell
PS> ./clone-shallow.ps1 [[-targetDir] <String>] [<CommonParameters>]
-targetDir <String>
Specifies the file path to the target directory (current working directory by default)
Required? false
Position? 1
Default value "$PWD"
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> ./clone-shallow C:\MyRepos
```
Notes
-----
Author: Markus Fleschutz | License: CC0
Related Links
-------------
https://github.com/fleschutz/PowerShell
Script Content
--------------
```powershell
<#
.SYNOPSIS
Clones a shallow Git repo
.DESCRIPTION
This PowerShell script clones popular Git repositories into a common target directory.
.PARAMETER URL
.PARAMETER branchName
.PARAMETER targetDir
Specifies the file path to the target directory (current working directory by default)
.EXAMPLE
PS> ./clone-shallow C:\MyRepos
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
param([string]$targetDir = "$PWD")
try {
$stopWatch = [system.diagnostics.stopwatch]::startNew()
$ git clone --branch $branchName --single-branch --depth 1 --recurse-submodules $URL $targetDir
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✔️ Cloned the shallow repository in $elapsed sec"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}
```
*(generated by convert-ps2md.ps1 using the comment-based help of clone-shallow.ps1 as of 08/15/2024 09:50:46)*

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 05/19/2024 10:25:19)* *(generated by convert-ps2md.ps1 using the comment-based help of close-calculator.ps1 as of 08/15/2024 09:50:46)*

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 05/19/2024 10:25:19)* *(generated by convert-ps2md.ps1 using the comment-based help of close-chrome.ps1 as of 08/15/2024 09:50:46)*

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 05/19/2024 10:25:19)* *(generated by convert-ps2md.ps1 using the comment-based help of close-cortana.ps1 as of 08/15/2024 09:50:46)*

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 05/19/2024 10:25:19)* *(generated by convert-ps2md.ps1 using the comment-based help of close-edge.ps1 as of 08/15/2024 09:50:46)*

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