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
c5b5cb1c6e
commit
aed2b7d940
@ -113,4 +113,4 @@ try {
|
||||
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of add-firewall-rules.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of add-firewall-rules.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -79,4 +79,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of add-memo.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of add-memo.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -71,4 +71,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of alert.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of alert.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -9,7 +9,7 @@ Parameters
|
||||
PS> ./build-repo.ps1 [[-path] <String>] [<CommonParameters>]
|
||||
|
||||
-path <String>
|
||||
Specifies the path to the Git repository (current working dir by default)
|
||||
Specifies the path to the Git repository (default is current working directory)
|
||||
|
||||
Required? false
|
||||
Position? 1
|
||||
@ -26,9 +26,9 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./build-repo.ps1 C:\Repos\ninja
|
||||
⏳ Building 📂ninja using CMakeLists.txt into 📂ninja/_My_Build...
|
||||
⏳ Building 📂ninja using CMakeLists.txt into 📂ninja/_Build_Results...
|
||||
...
|
||||
✔️ Built 📂ninja in 47 sec
|
||||
✔️ Built 📂ninja repository in 47 sec.
|
||||
|
||||
```
|
||||
|
||||
@ -49,12 +49,12 @@ Script Content
|
||||
.DESCRIPTION
|
||||
This PowerShell script builds a Git repository by supporting build systems such as: autogen, cmake, configure, Gradle, Imakefile, Makefile, and Meson.
|
||||
.PARAMETER path
|
||||
Specifies the path to the Git repository (current working dir by default)
|
||||
Specifies the path to the Git repository (default is current working directory)
|
||||
.EXAMPLE
|
||||
PS> ./build-repo.ps1 C:\Repos\ninja
|
||||
⏳ Building 📂ninja using CMakeLists.txt into 📂ninja/_My_Build...
|
||||
⏳ Building 📂ninja using CMakeLists.txt into 📂ninja/_Build_Results...
|
||||
...
|
||||
✔️ Built 📂ninja in 47 sec
|
||||
✔️ Built 📂ninja repository in 47 sec.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -66,11 +66,11 @@ param([string]$path = "$PWD")
|
||||
function BuildInDir([string]$path) {
|
||||
$dirName = (Get-Item "$path").Name
|
||||
if (Test-Path "$path/CMakeLists.txt" -pathType leaf) {
|
||||
"⏳ (1/4) Building 📂$dirName by using CMake into 📂$dirName/_My_Build..."
|
||||
if (-not(Test-Path "$path/_My_Build/" -pathType container)) {
|
||||
& mkdir "$path/_My_Build/"
|
||||
"⏳ (1/4) Building 📂$dirName by using CMake into 📂$dirName/_Build_Results..."
|
||||
if (-not(Test-Path "$path/_Build_Results/" -pathType container)) {
|
||||
& mkdir "$path/_Build_Results/"
|
||||
}
|
||||
Set-Location "$path/_My_Build/"
|
||||
Set-Location "$path/_Build_Results/"
|
||||
|
||||
"⏳ (2/4) Executing 'cmake' to generate the Makefile..."
|
||||
& cmake ..
|
||||
@ -184,7 +184,7 @@ try {
|
||||
|
||||
$repoDirName = (Get-Item "$path").Name
|
||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||
"✔️ Built repo 📂$repoDirName in $elapsed sec"
|
||||
"✔️ Built 📂$repoDirName repository in $elapsed sec."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -192,4 +192,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of build-repo.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of build-repo.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -82,4 +82,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of build-repos.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of build-repos.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -60,4 +60,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-autostart.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-autostart.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -63,4 +63,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-crashdumps.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-crashdumps.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -64,4 +64,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-desktop.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-desktop.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -64,4 +64,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-docs.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-docs.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -64,4 +64,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-downloads.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-downloads.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -60,4 +60,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-dropbox.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-dropbox.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -64,4 +64,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-etc.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-etc.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -60,4 +60,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-fonts.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-fonts.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -60,4 +60,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-home.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-home.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -48,4 +48,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-logs.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-logs.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -64,4 +64,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-music.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-music.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -60,4 +60,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-onedrive.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-onedrive.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -62,4 +62,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-pics.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-pics.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -62,4 +62,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-public.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-public.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -53,4 +53,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-recycle-bin.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-recycle-bin.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -6,9 +6,9 @@ This PowerShell script changes the working directory to the user's Git repositor
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./cd-repos.ps1 [[-Subpath] <String>] [<CommonParameters>]
|
||||
PS> ./cd-repos.ps1 [[-subpath] <String>] [<CommonParameters>]
|
||||
|
||||
-Subpath <String>
|
||||
-subpath <String>
|
||||
Specifies an additional relative subpath (optional)
|
||||
|
||||
Required? false
|
||||
@ -26,7 +26,13 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./cd-repos
|
||||
📂C:\Users\Markus\source\Repos
|
||||
📂C:\Users\Markus\Repos
|
||||
|
||||
|
||||
|
||||
PS> ./cd-repos rust
|
||||
📂C:\Users\Markus\Repos\rust
|
||||
on branch: ## main ... origin/main
|
||||
|
||||
```
|
||||
|
||||
@ -46,33 +52,47 @@ Script Content
|
||||
Sets the working directory to the user's repos folder
|
||||
.DESCRIPTION
|
||||
This PowerShell script changes the working directory to the user's Git repositories folder.
|
||||
.PARAMETER Subpath
|
||||
.PARAMETER subpath
|
||||
Specifies an additional relative subpath (optional)
|
||||
.EXAMPLE
|
||||
PS> ./cd-repos
|
||||
📂C:\Users\Markus\source\Repos
|
||||
📂C:\Users\Markus\Repos
|
||||
|
||||
PS> ./cd-repos rust
|
||||
📂C:\Users\Markus\Repos\rust
|
||||
on branch: ## main ... origin/main
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
param([string]$Subpath = "")
|
||||
param([string]$subpath = "")
|
||||
|
||||
try {
|
||||
if (Test-Path "$HOME/Repos" -pathType Container) { # try short name
|
||||
$Path = "$HOME/Repos/$Subpath"
|
||||
} elseif (Test-Path "$HOME/Repositories" -pathType Container) { # try long name
|
||||
$Path = "$HOME/Repositories/$Subpath"
|
||||
} elseif (Test-Path "$HOME/source/repos" -pathType Container) { # try Visual Studio default
|
||||
$Path = "$HOME/source/repos/$Subpath"
|
||||
if (Test-Path "$HOME/Repos/" -pathType Container) { # try short name
|
||||
$path = "$HOME/Repos/"
|
||||
} elseif (Test-Path "$HOME/repos/" -pathType Container) {
|
||||
$path = "$HOME/repos/"
|
||||
} elseif (Test-Path "$HOME/Repositories/" -pathType Container) { # try long name
|
||||
$path = "$HOME/Repositories/"
|
||||
} elseif (Test-Path "$HOME/source/repos/" -pathType Container) { # try Visual Studio default
|
||||
$path = "$HOME/source/repos/"
|
||||
} elseif (Test-Path "/Repos/" -pathType Container) {
|
||||
$path = "/Repos/"
|
||||
} else {
|
||||
throw "The folder for Git repositories in your home directory doesn't exist (yet)."
|
||||
throw "The folder for Git repositories doesn't exist (yet)"
|
||||
}
|
||||
if ("$subpath" -ne "") { $path += $subpath }
|
||||
if (-not(Test-Path "$path" -pathType Container)) { throw "The path to 📂$path doesn't exist (yet)" }
|
||||
$path = Resolve-Path "$path"
|
||||
Set-Location "$path"
|
||||
"📂$path"
|
||||
|
||||
if ("$subpath" -ne "") {
|
||||
Write-Host -noNewline " on branch: "
|
||||
& git status --short --branch --show-stash
|
||||
}
|
||||
if (-not(Test-Path "$Path" -pathType Container)) { throw "The path to 📂$Path doesn't exist (yet)." }
|
||||
$Path = Resolve-Path "$Path"
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
@ -80,4 +100,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-repos.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-repos.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -57,4 +57,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-root.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-root.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -55,4 +55,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-screenshots.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-screenshots.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -17,7 +17,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./cd-scripts
|
||||
📂C:\Users\Markus\source\repos\PowerShell\scripts
|
||||
📂C:\Users\Markus\Repos\PowerShell\scripts
|
||||
|
||||
```
|
||||
|
||||
@ -39,7 +39,7 @@ Script Content
|
||||
This PowerShell script changes the working directory to the PowerShell scripts folder.
|
||||
.EXAMPLE
|
||||
PS> ./cd-scripts
|
||||
📂C:\Users\Markus\source\repos\PowerShell\scripts
|
||||
📂C:\Users\Markus\Repos\PowerShell\scripts
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -47,10 +47,10 @@ Script Content
|
||||
#>
|
||||
|
||||
try {
|
||||
$Path = Resolve-Path "$PSScriptRoot"
|
||||
if (-not(Test-Path "$Path" -pathType container)) { throw "PowerShell scripts folder at 📂$Path doesn't exist (yet)" }
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
$path = Resolve-Path "$PSScriptRoot"
|
||||
if (-not(Test-Path "$path" -pathType container)) { throw "PowerShell scripts folder at 📂$path doesn't exist (yet)" }
|
||||
Set-Location "$path"
|
||||
"📂$path"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -58,4 +58,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-scripts.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-scripts.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -58,4 +58,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-ssh.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-ssh.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -50,4 +50,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-temp.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-temp.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -62,4 +62,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-templates.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-templates.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -53,4 +53,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-trash.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-trash.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -58,4 +58,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -58,4 +58,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up2.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up2.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -58,4 +58,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up3.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up3.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -58,4 +58,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up4.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up4.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -58,4 +58,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-users.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-users.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -62,4 +62,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-videos.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-videos.ps1 as of 03/27/2024 17:36:23)*
|
||||
|
@ -58,4 +58,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-windows.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-windows.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -79,4 +79,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of change-wallpaper.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of change-wallpaper.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -67,4 +67,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-admin.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-admin.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -75,4 +75,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-apps.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-apps.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -76,4 +76,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-bios.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-bios.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -101,4 +101,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-cpu.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-cpu.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -82,4 +82,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-credentials.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-credentials.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -57,4 +57,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-day.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-day.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -73,4 +73,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-dns.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-dns.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -35,7 +35,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./check-drive-space.ps1 C
|
||||
✅ Drive C: uses 56%, 442GB free of 999GB
|
||||
✅ Drive C: has 442GB free (56% of 1TB used)
|
||||
|
||||
```
|
||||
|
||||
@ -61,7 +61,7 @@ Script Content
|
||||
Specifies the minimum level in bytes (10GB by default)
|
||||
.EXAMPLE
|
||||
PS> ./check-drive-space.ps1 C
|
||||
✅ Drive C: uses 56%, 442GB free of 999GB
|
||||
✅ Drive C: has 442GB free (56% of 1TB used)
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -100,8 +100,8 @@ try {
|
||||
} elseif ($free -lt $minLevel) {
|
||||
Write-Host "⚠️ Drive $driveName with $(Bytes2String $total) is nearly full, $(Bytes2String $free) free"
|
||||
} else {
|
||||
[int]$percent = ($used * 100) / $total
|
||||
Write-Host "✅ Drive $driveName uses $percent%, $(Bytes2String $free) free of $(Bytes2String $total)"
|
||||
[int64]$percent = ($used * 100) / $total
|
||||
Write-Host "✅ Drive $driveName has $(Bytes2String $free) free ($percent% of $(Bytes2String $total) used)"
|
||||
}
|
||||
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 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-drive-space.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -9,7 +9,7 @@ Parameters
|
||||
PS> ./check-drives.ps1 [[-minLevel] <Int64>] [<CommonParameters>]
|
||||
|
||||
-minLevel <Int64>
|
||||
Specifies the minimum warning level (10 GB by default)
|
||||
Specifies the minimum warning level (10GB by default)
|
||||
|
||||
Required? false
|
||||
Position? 1
|
||||
@ -26,8 +26,8 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./check-drives.ps1
|
||||
✅ Drive C: uses 49%, 512GB free of 1TB
|
||||
✅ Drive D: uses 84%, 641GB free of 4TB
|
||||
✅ Drive C: has 512GB free (49% of 1TB used)
|
||||
✅ Drive D: has 641GB free (84% of 4TB used)
|
||||
|
||||
```
|
||||
|
||||
@ -48,11 +48,11 @@ Script Content
|
||||
.DESCRIPTION
|
||||
This PowerShell script queries the free space of all drives and prints it.
|
||||
.PARAMETER minLevel
|
||||
Specifies the minimum warning level (10 GB by default)
|
||||
Specifies the minimum warning level (10GB by default)
|
||||
.EXAMPLE
|
||||
PS> ./check-drives.ps1
|
||||
✅ Drive C: uses 49%, 512GB free of 1TB
|
||||
✅ Drive D: uses 84%, 641GB free of 4TB
|
||||
✅ Drive C: has 512GB free (49% of 1TB used)
|
||||
✅ Drive D: has 641GB free (84% of 4TB used)
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -61,24 +61,19 @@ Script Content
|
||||
|
||||
param([int64]$minLevel = 10) # 10 GB minimum
|
||||
|
||||
function Bytes2String { param([int64]$bytes)
|
||||
if ($bytes -lt 1000) { return "$bytes bytes" }
|
||||
$bytes /= 1000
|
||||
if ($bytes -lt 1000) { return "$($bytes)KB" }
|
||||
$bytes /= 1000
|
||||
if ($bytes -lt 1000) { return "$($bytes)MB" }
|
||||
$bytes /= 1000
|
||||
if ($bytes -lt 1000) { return "$($bytes)GB" }
|
||||
$bytes /= 1000
|
||||
if ($bytes -lt 1000) { return "$($bytes)TB" }
|
||||
$bytes /= 1000
|
||||
return "$($bytes)PB"
|
||||
function Bytes2String { param([int64]$number)
|
||||
if ($number -lt 1KB) { return "$number bytes" }
|
||||
if ($number -lt 1MB) { return '{0:N0}KB' -f ($number / 1KB) }
|
||||
if ($number -lt 1GB) { return '{0:N0}MB' -f ($number / 1MB) }
|
||||
if ($number -lt 1TB) { return '{0:N0}GB' -f ($number / 1GB) }
|
||||
if ($number -lt 1PB) { return '{0:N0}TB' -f ($number / 1TB) }
|
||||
return '{0:N0}GB' -f ($number / 1PB)
|
||||
}
|
||||
|
||||
try {
|
||||
Write-Progress "Querying drives..."
|
||||
$drives = Get-PSDrive -PSProvider FileSystem
|
||||
$minLevel *= 1000 * 1000 * 1000
|
||||
$minLevel *= 1GB
|
||||
Write-Progress -completed " "
|
||||
foreach($drive in $drives) {
|
||||
$details = (Get-PSDrive $drive.Name)
|
||||
@ -94,8 +89,8 @@ try {
|
||||
} elseif ($free -lt $minLevel) {
|
||||
Write-Host "⚠️ Drive $name with $(Bytes2String $total) is nearly full, $(Bytes2String $free) free"
|
||||
} else {
|
||||
[int]$percent = ($used * 100) / $total
|
||||
Write-Host "✅ Drive $name uses $percent%, $(Bytes2String $free) free of $(Bytes2String $total)"
|
||||
[int64]$percent = ($used * 100) / $total
|
||||
Write-Host "✅ Drive $name has $(Bytes2String $free) free ($percent% of $(Bytes2String $total) used)"
|
||||
}
|
||||
}
|
||||
exit 0 # success
|
||||
@ -105,4 +100,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-drives.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-drives.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -63,4 +63,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-dusk.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-dusk.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -61,4 +61,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-easter-sunday.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-easter-sunday.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -75,4 +75,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-file-system.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-file-system.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -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 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-file.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -65,4 +65,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-firewall.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-firewall.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -65,4 +65,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-gpu.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-gpu.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -57,10 +57,11 @@ Script Content
|
||||
& "$PSScriptRoot/check-cpu.ps1"
|
||||
& "$PSScriptRoot/check-ram.ps1"
|
||||
& "$PSScriptRoot/check-gpu.ps1"
|
||||
& "$PSScriptRoot/check-bios.ps1"
|
||||
& "$PSScriptRoot/check-smart-devices.ps1"
|
||||
& "$PSScriptRoot/check-drives.ps1"
|
||||
& "$PSScriptRoot/check-power.ps1"
|
||||
& "$PSScriptRoot/check-drives.ps1"
|
||||
exit 0 # success
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-hardware.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-hardware.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -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 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-health.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -61,4 +61,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-independence-day.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-independence-day.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -84,4 +84,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-ipv4-address.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-ipv4-address.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -98,4 +98,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-ipv6-address.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-ipv6-address.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -55,4 +55,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-iss-position.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-iss-position.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -87,4 +87,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-mac-address.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-mac-address.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -60,4 +60,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-midnight.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-midnight.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -57,4 +57,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-month.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-month.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -76,4 +76,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-moon-phase.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-moon-phase.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -65,4 +65,4 @@ Script Content
|
||||
exit 0 # success
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-network.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-network.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -60,4 +60,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-new-year.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-new-year.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -59,4 +59,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-noon.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-noon.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -73,4 +73,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-os.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-os.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -65,4 +65,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-outlook.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-outlook.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -94,4 +94,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-password.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-password.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -92,4 +92,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-pending-reboot.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-pending-reboot.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -58,7 +58,7 @@ try {
|
||||
if ($details.BatteryChargeStatus -eq "NoSystemBattery") {
|
||||
$reply = "✅ AC powered"
|
||||
} elseif ($percent -ge 95) {
|
||||
$reply = "✅ Battery fully charged ($percent%)"
|
||||
$reply = "✅ Battery $percent% full"
|
||||
} else {
|
||||
$reply = "✅ Battery charging ($percent%)"
|
||||
}
|
||||
@ -92,4 +92,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-power.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-power.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -59,4 +59,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-powershell.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-powershell.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -76,4 +76,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-ps1-file.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-ps1-file.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -98,4 +98,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-ram.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-ram.ps1 as of 03/27/2024 17:36:24)*
|
||||
|
@ -128,4 +128,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-repo.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-repo.ps1 as of 03/27/2024 17:36:25)*
|
||||
|
@ -82,4 +82,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-repos.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-repos.ps1 as of 03/27/2024 17:36:25)*
|
||||
|
@ -56,4 +56,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-santa.ps1 as of 01/25/2024 13:58:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-santa.ps1 as of 03/27/2024 17:36:25)*
|
||||
|
@ -95,4 +95,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-smart-devices.ps1 as of 01/25/2024 13:58:37)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-smart-devices.ps1 as of 03/27/2024 17:36:25)*
|
||||
|
@ -21,7 +21,6 @@ PS> ./check-software.ps1
|
||||
|
||||
|
||||
S O F T W A R E
|
||||
✅ BIOS model 'P62 v02.67' version HPQOEM - 0 by HP
|
||||
✅ Windows 10 Pro 64-Bit (v10.0.19045, since 5/2/2021)
|
||||
...
|
||||
|
||||
@ -47,7 +46,6 @@ Script Content
|
||||
PS> ./check-software.ps1
|
||||
|
||||
S O F T W A R E
|
||||
✅ BIOS model 'P62 v02.67' version HPQOEM - 0 by HP
|
||||
✅ Windows 10 Pro 64-Bit (v10.0.19045, since 5/2/2021)
|
||||
...
|
||||
.LINK
|
||||
@ -58,7 +56,6 @@ Script Content
|
||||
|
||||
" "
|
||||
& "$PSScriptRoot/write-green.ps1" " S O F T W A R E"
|
||||
& "$PSScriptRoot/check-bios.ps1"
|
||||
& "$PSScriptRoot/check-os.ps1"
|
||||
& "$PSScriptRoot/check-uptime.ps1"
|
||||
& "$PSScriptRoot/check-apps.ps1"
|
||||
@ -69,4 +66,4 @@ Script Content
|
||||
exit 0 # success
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-software.ps1 as of 01/25/2024 13:58:37)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-software.ps1 as of 03/27/2024 17:36:25)*
|
||||
|
@ -84,4 +84,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-subnet-mask.ps1 as of 01/25/2024 13:58:37)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-subnet-mask.ps1 as of 03/27/2024 17:36:25)*
|
||||
|
@ -26,7 +26,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./check-swap-space.ps1
|
||||
✅ Swap space uses 42%, 748MB free of 1GB
|
||||
✅ Swap space has 748MB free (42% of 1GB used)
|
||||
|
||||
```
|
||||
|
||||
@ -50,7 +50,7 @@ Script Content
|
||||
Specifies the minimum level in GB (10 GB by default)
|
||||
.EXAMPLE
|
||||
PS> ./check-swap-space.ps1
|
||||
✅ Swap space uses 42%, 748MB free of 1GB
|
||||
✅ Swap space has 748MB free (42% of 1GB used)
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -59,44 +59,46 @@ 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" }
|
||||
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" }
|
||||
}
|
||||
|
||||
try {
|
||||
[int64]$Total = [int64]$Used = [int64]$Free = 0
|
||||
|
||||
if ($IsLinux) {
|
||||
$Result = $(free --mega | grep Swap:)
|
||||
[int64]$Total = $Result.subString(5,14)
|
||||
[int64]$Used = $Result.substring(20,13)
|
||||
[int64]$Free = $Result.substring(32,11)
|
||||
[int64]$total = $Result.subString(5,14)
|
||||
[int64]$used = $Result.substring(20,13)
|
||||
[int64]$free = $Result.substring(32,11)
|
||||
} else {
|
||||
$Items = Get-WmiObject -class "Win32_PageFileUsage" -namespace "root\CIMV2" -computername localhost
|
||||
foreach ($Item in $Items) {
|
||||
$Total += $Item.AllocatedBaseSize
|
||||
$Used += $Item.CurrentUsage
|
||||
$Free += ($Total - $Used)
|
||||
}
|
||||
$items = Get-WmiObject -class "Win32_PageFileUsage" -namespace "root\CIMV2" -computername localhost
|
||||
[int64]$total = [int64]$used = 0
|
||||
foreach ($item in $items) {
|
||||
$total += $item.AllocatedBaseSize
|
||||
$used += $item.CurrentUsage
|
||||
|
||||
}
|
||||
[int64]$free = ($total - $used)
|
||||
}
|
||||
if ($Total -eq 0) {
|
||||
if ($total -eq 0) {
|
||||
Write-Output "⚠️ No swap space configured"
|
||||
} elseif ($Free -eq 0) {
|
||||
Write-Output "⚠️ Swap space of $(MB2String $Total) is full"
|
||||
} elseif ($Free -lt $minLevel) {
|
||||
Write-Output "⚠️ Swap space of $(MB2String $Total) is nearly full, only $(MB2String $Free) free"
|
||||
} elseif ($Used -lt 5) {
|
||||
Write-Output "✅ Swap space unused, $(MB2String $Free) free"
|
||||
} elseif ($free -eq 0) {
|
||||
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 the full $(MB2String $free) free"
|
||||
} else {
|
||||
[int]$Percent = ($Used * 100) / $Total
|
||||
Write-Output "✅ Swap space uses $Percent%, $(MB2String $Free) free of $(MB2String $Total)"
|
||||
[int64]$percent = ($used * 100) / $total
|
||||
Write-Output "✅ Swap space has $(MB2String $free) free ($percent% of $(MB2String $total) used)"
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
@ -105,4 +107,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-swap-space.ps1 as of 01/25/2024 13:58:37)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-swap-space.ps1 as of 03/27/2024 17:36:25)*
|
||||
|
@ -100,4 +100,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-symlinks.ps1 as of 01/25/2024 13:58:37)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-symlinks.ps1 as of 03/27/2024 17:36:25)*
|
||||
|
@ -65,4 +65,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-time-zone.ps1 as of 01/25/2024 13:58:37)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-time-zone.ps1 as of 03/27/2024 17:36:25)*
|
||||
|
@ -24,14 +24,14 @@ Script Content
|
||||
This PowerShell script queries the computer's uptime (time between now and last boot up time) and prints it.
|
||||
.EXAMPLE
|
||||
PS> ./check-uptime.ps1
|
||||
✅ Up for 2 days, 20 hours, 10 minutes
|
||||
✅ OfficePC is up for 13 days since 1/25/2024
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
function TimeSpan2String([TimeSpan]$uptime)
|
||||
function TimeSpanAsString([TimeSpan]$uptime)
|
||||
{
|
||||
[int]$days = $uptime.Days
|
||||
[int]$hours = $days * 24 + $uptime.Hours
|
||||
@ -45,15 +45,15 @@ function TimeSpan2String([TimeSpan]$uptime)
|
||||
}
|
||||
|
||||
try {
|
||||
[system.threading.thread]::currentthread.currentculture = [system.globalization.cultureinfo]"en-US"
|
||||
if ($IsLinux) {
|
||||
$lastBootTime = (Get-Uptime -since)
|
||||
$uptime = (Get-Uptime)
|
||||
Write-Host "✅ Up for $(TimeSpan2String $uptime)"
|
||||
} else {
|
||||
[system.threading.thread]::currentthread.currentculture = [system.globalization.cultureinfo]"en-US"
|
||||
$lastBootTime = (Get-CimInstance Win32_OperatingSystem).LastBootUpTime
|
||||
$uptime = New-TimeSpan -Start $lastBootTime -End (Get-Date)
|
||||
Write-Host "✅ Up for $(TimeSpan2String $uptime) since $($lastBootTime.ToShortDateString())"
|
||||
}
|
||||
Write-Host "✅ $(hostname) is up for $(TimeSpanAsString $uptime) since $($lastBootTime.ToShortDateString())"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -61,4 +61,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-uptime.ps1 as of 01/25/2024 13:58:37)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-uptime.ps1 as of 03/27/2024 17:36:25)*
|
||||
|
@ -65,4 +65,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-vpn.ps1 as of 01/25/2024 13:58:37)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-vpn.ps1 as of 03/27/2024 17:36:25)*
|
||||
|
@ -81,4 +81,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-weather.ps1 as of 01/25/2024 13:58:37)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-weather.ps1 as of 03/27/2024 17:36:25)*
|
||||
|
@ -54,4 +54,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-week.ps1 as of 01/25/2024 13:58:37)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-week.ps1 as of 03/27/2024 17:36:25)*
|
||||
|
@ -72,4 +72,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-wind.ps1 as of 01/25/2024 13:58:37)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-wind.ps1 as of 03/27/2024 17:36:25)*
|
||||
|
@ -60,4 +60,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-windows-system-files.ps1 as of 01/25/2024 13:58:37)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-windows-system-files.ps1 as of 03/27/2024 17:36:25)*
|
||||
|
@ -70,6 +70,7 @@ try {
|
||||
$ReaderSettings.ValidationType = [System.Xml.ValidationType]::Schema
|
||||
$ReaderSettings.ValidationFlags = [System.Xml.Schema.XmlSchemaValidationFlags]::ProcessInlineSchema -bor [System.Xml.Schema.XmlSchemaValidationFlags]::ProcessSchemaLocation
|
||||
$ReaderSettings.add_ValidationEventHandler({ $script:ErrorCount++ })
|
||||
$ReaderSettings.DtdProcessing = [System.Xml.DtdProcessing]::Parse
|
||||
$Reader = [System.Xml.XmlReader]::Create($XmlFile.FullName, $ReaderSettings)
|
||||
while ($Reader.Read()) { }
|
||||
$Reader.Close()
|
||||
@ -84,4 +85,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-xml-file.ps1 as of 01/25/2024 13:58:37)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-xml-file.ps1 as of 03/27/2024 17:36:25)*
|
||||
|
@ -1,7 +1,7 @@
|
||||
Script: *check-xml-files.ps1*
|
||||
========================
|
||||
|
||||
This PowerShell script verifies each XML file (with suffix .xml) in the given directory tree for validity.
|
||||
This PowerShell script verifies any XML file (with suffix .xml) in the given directory tree for validity.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
@ -27,7 +27,7 @@ Example
|
||||
```powershell
|
||||
PS> ./check-xml-files.ps1 C:\Windows
|
||||
...
|
||||
✔️ Checked 3387 XML files within 📂C:\Windows in 174 sec
|
||||
✔️ Checked 3387 XML files (2462 invalid, 925 valid) within 📂C:\Windows in 116 sec
|
||||
|
||||
```
|
||||
|
||||
@ -46,13 +46,13 @@ Script Content
|
||||
.SYNOPSIS
|
||||
Checks all XML files in a directory tree
|
||||
.DESCRIPTION
|
||||
This PowerShell script verifies each XML file (with suffix .xml) in the given directory tree for validity.
|
||||
This PowerShell script verifies any XML file (with suffix .xml) in the given directory tree for validity.
|
||||
.PARAMETER path
|
||||
Specifies the path to the directory tree (current working dir by default)
|
||||
.EXAMPLE
|
||||
PS> ./check-xml-files.ps1 C:\Windows
|
||||
...
|
||||
✔️ Checked 3387 XML files within 📂C:\Windows in 174 sec
|
||||
✔️ Checked 3387 XML files (2462 invalid, 925 valid) within 📂C:\Windows in 116 sec
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -63,19 +63,19 @@ param([string]$path = "$PWD")
|
||||
|
||||
try {
|
||||
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
$path = Resolve-Path "$path"
|
||||
[int]$numXmlFiles = 0
|
||||
Write-Progress "Scanning any XML file within $path..."
|
||||
[int]$valid = [int]$invalid = 0
|
||||
|
||||
Write-Progress "Scanning all XML files within $path..."
|
||||
Get-ChildItem -path "$path" -attributes !Directory -recurse -force | Where-Object { $_.Name -like "*.xml" } | Foreach-Object {
|
||||
& $PSScriptRoot/check-xml-file.ps1 "$($_.FullName)"
|
||||
$numXmlFiles++
|
||||
if ($lastExitCode -eq 0) { $valid++ } else { $invalid++ }
|
||||
}
|
||||
Write-Progress -completed "Done."
|
||||
|
||||
[int]$total = $valid + $invalid
|
||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||
"✔️ Checked $numXmlFiles XML files within 📂$path in $elapsed sec"
|
||||
"✔️ Checked $total XML files ($invalid invalid, $valid valid) within 📂$path in $elapsed sec"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -83,4 +83,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-xml-files.ps1 as of 01/25/2024 13:58:37)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-xml-files.ps1 as of 03/27/2024 17:36:25)*
|
||||
|
@ -7,9 +7,9 @@ NOTE: To be used with care! This cannot be undone!
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./clean-repo.ps1 [[-RepoDir] <String>] [<CommonParameters>]
|
||||
PS> ./clean-repo.ps1 [[-pathToRepo] <String>] [<CommonParameters>]
|
||||
|
||||
-RepoDir <String>
|
||||
-pathToRepo <String>
|
||||
Specifies the file path to the local Git repository
|
||||
|
||||
Required? false
|
||||
@ -31,7 +31,7 @@ PS> ./clean-repo.ps1 C:\rust
|
||||
⏳ (2/4) Checking local repository... 📂C:\rust
|
||||
⏳ (3/4) Removing untracked files in repository...
|
||||
⏳ (4/4) Removing untracked files in submodules...
|
||||
✔️ Cleaned repo 📂rust in 1 sec
|
||||
✔️ Cleaned up 📂rust repository in 1 sec.
|
||||
|
||||
```
|
||||
|
||||
@ -52,7 +52,7 @@ 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 RepoDir
|
||||
.PARAMETER pathToRepo
|
||||
Specifies the file path to the local Git repository
|
||||
.EXAMPLE
|
||||
PS> ./clean-repo.ps1 C:\rust
|
||||
@ -60,40 +60,40 @@ Script Content
|
||||
⏳ (2/4) Checking local repository... 📂C:\rust
|
||||
⏳ (3/4) Removing untracked files in repository...
|
||||
⏳ (4/4) Removing untracked files in submodules...
|
||||
✔️ Cleaned repo 📂rust in 1 sec
|
||||
✔️ Cleaned up 📂rust repository in 1 sec.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
param([string]$RepoDir = "$PWD")
|
||||
param([string]$pathToRepo = "$PWD")
|
||||
|
||||
try {
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
Write-Host "⏳ (1/4) Searching for Git executable... " -noNewline
|
||||
& git --version
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||
|
||||
"⏳ (2/4) Checking local repository... 📂$RepoDir"
|
||||
if (-not(Test-Path "$RepoDir" -pathType container)) { throw "Can't access folder '$RepoDir' - maybe a typo or missing folder permissions?" }
|
||||
$RepoDirName = (Get-Item "$RepoDir").Name
|
||||
"⏳ (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
|
||||
|
||||
"⏳ (3/4) Removing untracked files in repository..."
|
||||
& git -C "$RepoDir" clean -xfd -f # to delete all untracked files in the main repo
|
||||
& git -C "$pathToRepo" clean -xfd -f # to delete all untracked files in the main repo
|
||||
if ($lastExitCode -ne "0") {
|
||||
Write-Warning "'git clean' failed with exit code $lastExitCode, retrying once..."
|
||||
& git -C "$RepoDir" clean -xfd -f
|
||||
& git -C "$pathToRepo" clean -xfd -f
|
||||
if ($lastExitCode -ne "0") { throw "'git clean' failed with exit code $lastExitCode" }
|
||||
}
|
||||
|
||||
"⏳ (4/4) Removing untracked files in submodules..."
|
||||
& git -C "$RepoDir" submodule foreach --recursive git clean -xfd -f # to delete all untracked files in the submodules
|
||||
& git -C "$pathToRepo" submodule foreach --recursive git clean -xfd -f # to delete all untracked files in the submodules
|
||||
if ($lastExitCode -ne "0") { throw "'git clean' in the submodules failed with exit code $lastExitCode" }
|
||||
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
"✔️ Cleaned repo 📂$RepoDirName in $Elapsed sec"
|
||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||
"✔️ Cleaned up 📂$repoName repository in $elapsed sec."
|
||||
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 01/25/2024 13:58:37)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clean-repo.ps1 as of 03/27/2024 17:36:25)*
|
||||
|
@ -100,4 +100,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clean-repos.ps1 as of 01/25/2024 13:58:37)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clean-repos.ps1 as of 03/27/2024 17:36:25)*
|
||||
|
@ -60,4 +60,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clear-dns-cache.ps1 as of 01/25/2024 13:58:37)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clear-dns-cache.ps1 as of 03/27/2024 17:36:25)*
|
||||
|
@ -58,4 +58,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clear-recycle-bin.ps1 as of 01/25/2024 13:58:37)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clear-recycle-bin.ps1 as of 03/27/2024 17:36:25)*
|
||||
|
@ -112,4 +112,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clone-repos.ps1 as of 01/25/2024 13:58:37)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clone-repos.ps1 as of 03/27/2024 17:36:25)*
|
||||
|
@ -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 01/25/2024 13:58:37)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of close-calculator.ps1 as of 03/27/2024 17:36:25)*
|
||||
|
@ -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 01/25/2024 13:58:37)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of close-chrome.ps1 as of 03/27/2024 17:36:25)*
|
||||
|
@ -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 01/25/2024 13:58:37)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of close-cortana.ps1 as of 03/27/2024 17:36:25)*
|
||||
|
@ -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 01/25/2024 13:58:37)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of close-edge.ps1 as of 03/27/2024 17:36:25)*
|
||||
|
@ -48,4 +48,4 @@ Script Content
|
||||
exit 0 # success
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of close-file-explorer.ps1 as of 01/25/2024 13:58:37)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of close-file-explorer.ps1 as of 03/27/2024 17:36:25)*
|
||||
|
@ -48,4 +48,4 @@ Script Content
|
||||
exit 0 # success
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of close-firefox.ps1 as of 01/25/2024 13:58:37)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of close-firefox.ps1 as of 03/27/2024 17:36:25)*
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user