mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-21 15:33:15 +01:00
Updated the manuals
This commit is contained in:
parent
654d1a18d0
commit
e1ffab5509
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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
63
docs/cd-recent.md
Normal 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)*
|
@ -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)*
|
||||
|
@ -1,7 +1,7 @@
|
||||
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
|
||||
----------
|
||||
@ -9,7 +9,7 @@ Parameters
|
||||
PS> ./cd-repo.ps1 [[-folderName] <String>] [<CommonParameters>]
|
||||
|
||||
-folderName <String>
|
||||
Specifies the folder name
|
||||
Specifies the Git repository's folder name
|
||||
|
||||
Required? false
|
||||
Position? 1
|
||||
@ -26,7 +26,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
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
|
||||
Sets the working directory to a repository
|
||||
.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
|
||||
Specifies the folder name
|
||||
Specifies the Git repository's folder name
|
||||
.EXAMPLE
|
||||
PS> ./cd-repo.ps1 rust
|
||||
📂C:\Repos\rust • on Git branch: ## main ... origin/main
|
||||
📂C:\Repos\rust - current branch is: ## main ... origin/main
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -60,7 +60,7 @@ Script Content
|
||||
param([string]$folderName = "")
|
||||
|
||||
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
|
||||
$path = "$HOME/Repos/"
|
||||
@ -80,8 +80,7 @@ try {
|
||||
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
|
||||
|
||||
Write-Host "📂$path - current branch is: " -noNewline
|
||||
& git status --short --branch --show-stash
|
||||
exit 0 # success
|
||||
} 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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -17,7 +17,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
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.
|
||||
.EXAMPLE
|
||||
PS> ./check-admin.ps1
|
||||
✅ Yes
|
||||
✅ Yes, Markus has admin rights.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -53,18 +53,18 @@ try {
|
||||
$user = [Security.Principal.WindowsIdentity]::GetCurrent()
|
||||
$principal = (New-Object Security.Principal.WindowsPrincipal $user)
|
||||
if ($principal.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)) {
|
||||
"✅ Yes"
|
||||
"✅ Yes, $USERNAME has admin rights."
|
||||
} elseif ($principal.IsInRole([Security.Principal.WindowsBuiltinRole]::Guest)) {
|
||||
"⚠️ No, guest rights only"
|
||||
"⚠️ No, $USERNAME, has guest rights only."
|
||||
} else {
|
||||
"⚠️ No, normal user rights only"
|
||||
"⚠️ No, $USERNAME has normal user rights only."
|
||||
}
|
||||
}
|
||||
exit 0 # success
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
"⚠️ Error: $($Error[0]) (in script line $($_.InvocationInfo.ScriptLineNumber))"
|
||||
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)*
|
||||
|
@ -65,7 +65,7 @@ try {
|
||||
$statusMsg += ", $numUpdates upgrades available"
|
||||
|
||||
$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"
|
||||
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)*
|
||||
|
@ -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)*
|
||||
|
@ -61,7 +61,7 @@ function GetCPUTemperature {
|
||||
}
|
||||
|
||||
try {
|
||||
Write-Progress "Querying CPU status... "
|
||||
Write-Progress "Querying CPU status..."
|
||||
$status = "✅"
|
||||
$arch = GetCPUArchitecture
|
||||
if ($IsLinux) {
|
||||
@ -76,24 +76,24 @@ try {
|
||||
$arch = "$arch, "
|
||||
$deviceID = "$($details.DeviceID), "
|
||||
$speed = "$($details.MaxClockSpeed)MHz, "
|
||||
$socket = "$($details.SocketDesignation) socket, "
|
||||
$socket = "$($details.SocketDesignation) socket"
|
||||
}
|
||||
$cores = [System.Environment]::ProcessorCount
|
||||
$celsius = GetCPUTemperature
|
||||
if ($celsius -eq 99999.9) {
|
||||
$temp = "no temp"
|
||||
} elseif ($celsius -gt 50) {
|
||||
$temp = "$($celsius)°C"
|
||||
$temp = "$($celsius)°C HOT"
|
||||
$status = "⚠️"
|
||||
} elseif ($celsius -lt 0) {
|
||||
$temp = "$($celsius)°C"
|
||||
$temp = "$($celsius)°C COLD"
|
||||
$status = "⚠️"
|
||||
} else {
|
||||
$temp = "$($celsius)°C"
|
||||
$temp = "$($celsius)°C OK"
|
||||
}
|
||||
|
||||
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
|
||||
} catch {
|
||||
"⚠️ 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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -47,7 +47,7 @@ Script Content
|
||||
#>
|
||||
|
||||
try {
|
||||
Write-Progress "Measuring DNS resolution..."
|
||||
#Write-Progress "Measuring DNS resolution..."
|
||||
$table = Import-CSV "$PSScriptRoot/../data/popular-domains.csv"
|
||||
$numRows = $table.Length
|
||||
|
||||
@ -59,7 +59,7 @@ try {
|
||||
}
|
||||
[float]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||
|
||||
Write-Progress -completed " "
|
||||
#Write-Progress -completed "Measuring DNS resolution..."
|
||||
$average = [math]::round($numRows / $elapsed, 1)
|
||||
if ($average -lt 10.0) {
|
||||
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)*
|
||||
|
@ -35,7 +35,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
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)
|
||||
.EXAMPLE
|
||||
PS> ./check-drive-space.ps1 C
|
||||
✅ Drive C: has 442GB free (56% of 1TB used)
|
||||
✅ Drive C: uses 56% of 1TB - 442GB free
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -101,7 +101,7 @@ try {
|
||||
Write-Host "⚠️ Drive $driveName with $(Bytes2String $total) is nearly full, $(Bytes2String $free) free"
|
||||
} else {
|
||||
[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
|
||||
} 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)*
|
||||
|
@ -26,8 +26,8 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./check-drives.ps1
|
||||
✅ Drive C: has 512GB free (49% of 1TB used)
|
||||
✅ Drive D: has 641GB free (84% of 4TB used)
|
||||
✅ Drive C: uses 49% of 1TB - 512GB free
|
||||
✅ Drive D: uses 84% of 4TB - 641GB free
|
||||
|
||||
```
|
||||
|
||||
@ -51,8 +51,8 @@ Script Content
|
||||
Specifies the minimum warning level (10GB by default)
|
||||
.EXAMPLE
|
||||
PS> ./check-drives.ps1
|
||||
✅ Drive C: has 512GB free (49% of 1TB used)
|
||||
✅ Drive D: has 641GB free (84% of 4TB used)
|
||||
✅ Drive C: uses 49% of 1TB - 512GB free
|
||||
✅ Drive D: uses 84% of 4TB - 641GB free
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -90,7 +90,7 @@ try {
|
||||
Write-Host "⚠️ Drive $name with $(Bytes2String $total) is nearly full, $(Bytes2String $free) free"
|
||||
} else {
|
||||
[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
|
||||
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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 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)*
|
||||
|
@ -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)*
|
||||
|
@ -24,7 +24,7 @@ Script Content
|
||||
This PowerShell script queries the GPU status and prints it.
|
||||
.EXAMPLE
|
||||
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
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -56,7 +56,7 @@ try {
|
||||
$RefreshRate = $Details.CurrentRefreshRate
|
||||
$DriverVersion = $Details.DriverVersion
|
||||
$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
|
||||
} 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)*
|
||||
|
@ -63,4 +63,4 @@ Write-Host "`n H A R D W A R E" -foregroundColor green
|
||||
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)*
|
||||
|
@ -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 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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -55,13 +55,13 @@ Script Content
|
||||
#>
|
||||
|
||||
Write-Host "`n N E T W O R K" -foregroundColor green
|
||||
& "$PSScriptRoot/list-ip-addresses.ps1"
|
||||
& "$PSScriptRoot/ping-remote-hosts.ps1"
|
||||
& "$PSScriptRoot/check-firewall"
|
||||
& "$PSScriptRoot/check-dns.ps1"
|
||||
& "$PSScriptRoot/check-vpn.ps1"
|
||||
& "$PSScriptRoot/list-public-ip.ps1"
|
||||
& "$PSScriptRoot/ping-local-hosts.ps1"
|
||||
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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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
68
docs/check-pnp-devices.md
Normal 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)*
|
@ -17,7 +17,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
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.
|
||||
.EXAMPLE
|
||||
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
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -68,23 +68,23 @@ try {
|
||||
} elseif ($remaining -eq 0) {
|
||||
$reply = "✅ Battery at $percent%"
|
||||
} 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) {
|
||||
$reply = "⚠️ Battery at $percent% · only $($remaining)min remaining"
|
||||
$reply = "⚠️ Battery at $percent% with only $($remaining)min remaining"
|
||||
} elseif ($percent -lt 10) {
|
||||
$reply = "⚠️ Battery at $percent% · $($remaining)min remaining"
|
||||
} elseif ($percent -ge 60) {
|
||||
$reply = "✅ Battery $percent% full · $($remaining)min remaining"
|
||||
$reply = "⚠️ Battery at $percent% with $($remaining)min remaining"
|
||||
} elseif ($percent -ge 80) {
|
||||
$reply = "✅ Battery $percent% full with $($remaining)min remaining"
|
||||
} else {
|
||||
$reply = "✅ Battery at $percent% · $($remaining)min remaining"
|
||||
$reply = "✅ Battery at $percent% with $($remaining)min remaining"
|
||||
}
|
||||
}
|
||||
$powerScheme = (powercfg /getactivescheme)
|
||||
$powerScheme = $powerScheme -Replace "^(.*) \(",""
|
||||
$powerScheme = $powerScheme -Replace "\)$",""
|
||||
$reply += " · power scheme '$powerScheme'"
|
||||
$reply += ", power scheme is '$powerScheme'"
|
||||
}
|
||||
Write-Output $reply
|
||||
Write-Host $reply
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ 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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -24,7 +24,7 @@ Script Content
|
||||
This PowerShell script queries the status of the installed RAM memory modules and prints it.
|
||||
.EXAMPLE
|
||||
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
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -88,7 +88,7 @@ try {
|
||||
[float]$Voltage = $Bank.ConfiguredVoltage / 1000.0
|
||||
$Manufacturer = $Bank.Manufacturer
|
||||
$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
|
||||
@ -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)*
|
||||
|
@ -27,7 +27,7 @@ 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 repository... 📂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... OK
|
||||
@ -58,7 +58,7 @@ Script Content
|
||||
.EXAMPLE
|
||||
PS> ./check-repo.ps1 C:\MyRepo
|
||||
⏳ (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
|
||||
⏳ (4/10) Querying current branch... main
|
||||
⏳ (5/10) Fetching remote updates... OK
|
||||
@ -83,7 +83,7 @@ try {
|
||||
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"
|
||||
"$FullPath"
|
||||
|
||||
Write-Host "⏳ (3/10) Querying remote URL... " -noNewline
|
||||
& git -C "$FullPath" remote get-url origin
|
||||
@ -121,7 +121,7 @@ try {
|
||||
|
||||
$repoDirName = (Get-Item "$FullPath").Name
|
||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||
"✔️ Checked repo 📂$repoDirName in $($elapsed)s."
|
||||
"✔️ Checked 📂$repoDirName repo in $($elapsed)s."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ 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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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.
|
||||
.EXAMPLE
|
||||
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
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -48,18 +48,18 @@ function Bytes2String([int64]$bytes) {
|
||||
}
|
||||
|
||||
try {
|
||||
Write-Progress "(1/3) Searching for smartmontools..."
|
||||
#Write-Progress "(1/3) Searching for smartmontools..."
|
||||
$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..."
|
||||
#Write-Progress "(2/3) Scanning S.M.A.R.T devices..."
|
||||
if ($IsLinux) {
|
||||
$devices = $(sudo smartctl --scan-open)
|
||||
} else {
|
||||
$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) {
|
||||
$array = $device.split(" ")
|
||||
$dev = $array[0]
|
||||
@ -100,15 +100,15 @@ try {
|
||||
$powerOn = "$($details.power_cycle_count)x on/off"
|
||||
}
|
||||
if ($details.smart_status.passed) {
|
||||
$selftest = "selftest passed"
|
||||
$selftest = "selftest OK"
|
||||
} else {
|
||||
$selftest = "selftest FAILED"
|
||||
$status = "⚠️"
|
||||
}
|
||||
$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
|
||||
} catch {
|
||||
"⚠️ 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)*
|
||||
|
@ -65,4 +65,4 @@ Write-Host "`n S O F T W A R E" -foregroundColor green
|
||||
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)*
|
||||
|
@ -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)*
|
||||
|
@ -9,7 +9,7 @@ Parameters
|
||||
PS> ./check-swap-space.ps1 [[-minLevel] <Int32>] [<CommonParameters>]
|
||||
|
||||
-minLevel <Int32>
|
||||
Specifies the minimum level in GB (10 GB by default)
|
||||
Specifies the minimum level in MB (10 MB by default)
|
||||
|
||||
Required? false
|
||||
Position? 1
|
||||
@ -26,7 +26,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
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
|
||||
This PowerShell script queries the current status of the swap space and prints it.
|
||||
.PARAMETER minLevel
|
||||
Specifies the minimum level in GB (10 GB by default)
|
||||
Specifies the minimum level in MB (10 MB by default)
|
||||
.EXAMPLE
|
||||
PS> ./check-swap-space.ps1
|
||||
✅ Swap space has 748MB free (42% of 1GB used)
|
||||
✅ Swap space uses 21% of 1GB - 1005MB free
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -60,15 +60,15 @@ Script Content
|
||||
param([int]$minLevel = 10)
|
||||
|
||||
function MB2String { param([int64]$bytes)
|
||||
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" }
|
||||
if ($bytes -lt 1024) { return "$($bytes)MB" }
|
||||
$bytes /= 1024
|
||||
if ($bytes -lt 1024) { return "$($bytes)GB" }
|
||||
$bytes /= 1024
|
||||
if ($bytes -lt 1024) { return "$($bytes)TB" }
|
||||
$bytes /= 1024
|
||||
if ($bytes -lt 1024) { return "$($bytes)PB" }
|
||||
$bytes /= 1024
|
||||
if ($bytes -lt 1024) { return "$($bytes)EB" }
|
||||
}
|
||||
|
||||
try {
|
||||
@ -94,11 +94,11 @@ try {
|
||||
Write-Output "⚠️ Swap space of $(MB2String $total) is full"
|
||||
} 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 all $(MB2String $free) free"
|
||||
} elseif ($used -lt 3) {
|
||||
Write-Output "✅ Swap space unused - full $(MB2String $free) free"
|
||||
} else {
|
||||
[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
|
||||
} 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)*
|
||||
|
@ -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)*
|
||||
|
@ -1,7 +1,7 @@
|
||||
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
|
||||
----------
|
||||
@ -17,7 +17,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
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
|
||||
Checks the time zone
|
||||
.DESCRIPTION
|
||||
This PowerShell script queries the time zone and prints it.
|
||||
This PowerShell script queries the local time zone and prints it.
|
||||
.EXAMPLE
|
||||
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
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -50,14 +50,15 @@ try {
|
||||
[system.threading.thread]::currentThread.currentCulture = [system.globalization.cultureInfo]"en-US"
|
||||
$Time = $((Get-Date).ToShortTimeString())
|
||||
$TZ = (Get-Timezone)
|
||||
$offset = $TZ.BaseUtcOffset
|
||||
if ($TZ.SupportsDaylightSavingTime) {
|
||||
$TZName = $TZ.DaylightName
|
||||
$DST=" (+01:00 DST)"
|
||||
$DST=" +1h DST"
|
||||
} else {
|
||||
$TZName = $TZ.StandardName
|
||||
$DST=""
|
||||
}
|
||||
Write-Host "✅ $Time $TZName $($TZ.DisplayName)$($DST)"
|
||||
Write-Host "✅ $Time in $TZName (UTC+$($offset)$($DST))"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ 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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -7,10 +7,10 @@ NOTE: To be used with care! This cannot be undone!
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./clean-repo.ps1 [[-pathToRepo] <String>] [<CommonParameters>]
|
||||
PS> ./clean-repo.ps1 [[-path] <String>] [<CommonParameters>]
|
||||
|
||||
-pathToRepo <String>
|
||||
Specifies the file path to the local Git repository
|
||||
-path <String>
|
||||
Specifies the file path to the local Git repository (current working directory by default)
|
||||
|
||||
Required? false
|
||||
Position? 1
|
||||
@ -26,12 +26,12 @@ PS> ./clean-repo.ps1 [[-pathToRepo] <String>] [<CommonParameters>]
|
||||
Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./clean-repo.ps1 C:\rust
|
||||
⏳ (1/4) Searching for Git executable... git version 2.41.0.windows.3
|
||||
⏳ (2/4) Checking local repository... 📂C:\rust
|
||||
PS> ./clean-repo.ps1 C:\Repos\rust
|
||||
⏳ (1/4) Searching for Git executable... git version 2.45.0
|
||||
⏳ (2/4) Checking local repository... C:\Repos\rust
|
||||
⏳ (3/4) Removing untracked files in repository...
|
||||
⏳ (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
|
||||
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!
|
||||
.PARAMETER pathToRepo
|
||||
Specifies the file path to the local Git repository
|
||||
.PARAMETER path
|
||||
Specifies the file path to the local Git repository (current working directory by default)
|
||||
.EXAMPLE
|
||||
PS> ./clean-repo.ps1 C:\rust
|
||||
⏳ (1/4) Searching for Git executable... git version 2.41.0.windows.3
|
||||
⏳ (2/4) Checking local repository... 📂C:\rust
|
||||
PS> ./clean-repo.ps1 C:\Repos\rust
|
||||
⏳ (1/4) Searching for Git executable... git version 2.45.0
|
||||
⏳ (2/4) Checking local repository... C:\Repos\rust
|
||||
⏳ (3/4) Removing untracked files in repository...
|
||||
⏳ (4/4) Removing untracked files in submodules...
|
||||
✔️ Repo 📂rust is clean now (took 1s).
|
||||
✔️ Cleaned up 📂rust repository in 2s.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
param([string]$pathToRepo = "$PWD")
|
||||
param([string]$path = "$PWD")
|
||||
|
||||
try {
|
||||
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
@ -76,24 +76,24 @@ try {
|
||||
& git --version
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||
|
||||
"⏳ (2/4) Checking local repository... 📂$pathToRepo"
|
||||
if (-not(Test-Path "$pathToRepo" -pathType container)) { throw "Can't access repo folder '$pathToRepo' - maybe a typo or missing folder permissions?" }
|
||||
$repoName = (Get-Item "$pathToRepo").Name
|
||||
"⏳ (2/4) Checking local repository... $path"
|
||||
if (-not(Test-Path "$path" -pathType container)) { throw "Can't access repo folder '$path' - maybe a typo or missing folder permissions?" }
|
||||
$repoName = (Get-Item "$path").Name
|
||||
|
||||
"⏳ (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") {
|
||||
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" }
|
||||
}
|
||||
|
||||
"⏳ (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" }
|
||||
|
||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||
"✔️ Repo 📂$repoName is clean now (took $($elapsed)s)."
|
||||
"✔️ Cleaned up 📂$repoName repository in $($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 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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -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)*
|
||||
|
@ -27,7 +27,7 @@ Example
|
||||
```powershell
|
||||
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
|
||||
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
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -64,17 +64,17 @@ param([string]$targetDir = "$PWD")
|
||||
try {
|
||||
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
Write-Host "⏳ (1) Searching for Git executable... " -noNewline
|
||||
Write-Host "⏳ (1) 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) Reading data/popular-repositories.csv... " -noNewline
|
||||
$table = Import-CSV "$PSScriptRoot/../data/popular-repositories.csv"
|
||||
Write-Host "⏳ (2) Reading data/popular-repos.csv... " -noNewline
|
||||
$table = Import-CSV "$PSScriptRoot/../data/popular-repos.csv"
|
||||
$total = $table.count
|
||||
Write-Host "$total repos"
|
||||
|
||||
$targetDirName = (Get-Item "$targetDir").Name
|
||||
Write-Host "⏳ (3) Checking target folder... 📂$targetDirName"
|
||||
Write-Host "⏳ (3) Checking target folder... 📂$targetDirName"
|
||||
if (-not(Test-Path "$targetDir" -pathType container)) { throw "Can't access directory: $targetDir" }
|
||||
|
||||
[int]$step = 3
|
||||
@ -89,22 +89,22 @@ try {
|
||||
$step++
|
||||
|
||||
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++
|
||||
} 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"
|
||||
if ($lastExitCode -ne "0") { throw "'git clone --branch $branch $URL' failed with exit code $lastExitCode" }
|
||||
$cloned++
|
||||
} 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"
|
||||
if ($lastExitCode -ne "0") { throw "'git clone --branch $branch $URL' failed with exit code $lastExitCode" }
|
||||
$clone++
|
||||
}
|
||||
}
|
||||
[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
|
||||
} catch {
|
||||
"⚠️ 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
77
docs/clone-shallow.md
Normal 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)*
|
@ -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 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)*
|
||||
|
@ -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 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)*
|
||||
|
@ -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 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)*
|
||||
|
@ -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 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
Loading…
Reference in New Issue
Block a user