mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-24 17:03:45 +01:00
Updated the Markdown manuals
This commit is contained in:
parent
c24030c909
commit
439fbf5bfa
@ -113,4 +113,4 @@ try {
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of add-firewall-rules.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of add-firewall-rules.ps1 as of 05/19/2024 10:25:16)*
|
||||||
|
@ -79,4 +79,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of add-memo.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of add-memo.ps1 as of 05/19/2024 10:25:16)*
|
||||||
|
@ -71,4 +71,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of alert.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of alert.ps1 as of 05/19/2024 10:25:16)*
|
||||||
|
@ -74,22 +74,36 @@ function BuildInDir([string]$path) {
|
|||||||
|
|
||||||
"⏳ (2/4) Executing 'cmake' to generate the Makefile..."
|
"⏳ (2/4) Executing 'cmake' to generate the Makefile..."
|
||||||
& cmake ..
|
& cmake ..
|
||||||
if ($lastExitCode -ne "0") { throw "Executing 'cmake ..' has failed" }
|
if ($lastExitCode -ne "0") { throw "Executing 'cmake ..' exited with error code $lastExitCode" }
|
||||||
|
|
||||||
"⏳ (3/4) Executing 'make -j4' to compile and link..."
|
"⏳ (3/4) Executing 'make -j4' to compile and link..."
|
||||||
& make -j4
|
& make -j4
|
||||||
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
|
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' exited with error code $lastExitCode" }
|
||||||
|
|
||||||
"⏳ (4/4) Executing 'ctest -V' to perform tests (optional)..."
|
"⏳ (4/4) Executing 'ctest -V' to perform tests (optional)..."
|
||||||
& ctest -V
|
& ctest -V
|
||||||
if ($lastExitCode -ne "0") { throw "Executing 'make test' has failed" }
|
if ($lastExitCode -ne "0") { throw "Executing 'ctest -V' exited with error code $lastExitCode" }
|
||||||
|
|
||||||
|
} elseif (Test-Path "$path/autogen.sh" -pathType leaf) {
|
||||||
|
"⏳ Building 📂$dirName by using 'autogen.sh'..."
|
||||||
|
Set-Location "$path/"
|
||||||
|
|
||||||
|
& ./autogen.sh --force
|
||||||
|
if ($lastExitCode -ne "0") { throw "Executing './autogen.sh --force' exited with error code $lastExitCode" }
|
||||||
|
|
||||||
|
& ./configure
|
||||||
|
if ($lastExitCode -ne "0") { throw "Executing './configure' exited with error code $lastExitCode" }
|
||||||
|
|
||||||
|
& make -j4
|
||||||
|
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' exited with error code $lastExitCode" }
|
||||||
|
|
||||||
|
|
||||||
} elseif (Test-Path "$path/configure" -pathType leaf) {
|
} elseif (Test-Path "$path/configure" -pathType leaf) {
|
||||||
"⏳ Building 📂$dirName by using 'configure'..."
|
"⏳ Building 📂$dirName by using 'configure'..."
|
||||||
Set-Location "$path/"
|
Set-Location "$path/"
|
||||||
|
|
||||||
& ./configure
|
& ./configure
|
||||||
#if ($lastExitCode -ne "0") { throw "Script 'configure' exited with error code $lastExitCode" }
|
#if ($lastExitCode -ne "0") { throw "Executing './configure' exited with error code $lastExitCode" }
|
||||||
|
|
||||||
& make -j4
|
& make -j4
|
||||||
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
|
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
|
||||||
@ -97,31 +111,21 @@ function BuildInDir([string]$path) {
|
|||||||
& make test
|
& make test
|
||||||
if ($lastExitCode -ne "0") { throw "Executing 'make test' has failed" }
|
if ($lastExitCode -ne "0") { throw "Executing 'make test' has failed" }
|
||||||
|
|
||||||
} elseif (Test-Path "$path/autogen.sh" -pathType leaf) {
|
|
||||||
"⏳ Building 📂$dirName by using 'autogen.sh'..."
|
|
||||||
Set-Location "$path/"
|
|
||||||
|
|
||||||
& ./autogen.sh
|
|
||||||
if ($lastExitCode -ne "0") { throw "Script 'autogen.sh' exited with error code $lastExitCode" }
|
|
||||||
|
|
||||||
& make -j4
|
|
||||||
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
|
|
||||||
|
|
||||||
} elseif (Test-Path "$path/build.gradle" -pathType leaf) {
|
} elseif (Test-Path "$path/build.gradle" -pathType leaf) {
|
||||||
"⏳ Building 📂$dirName by using Gradle..."
|
"⏳ Building 📂$dirName by using Gradle..."
|
||||||
Set-Location "$path"
|
Set-Location "$path"
|
||||||
|
|
||||||
& gradle build
|
& gradle build
|
||||||
if ($lastExitCode -ne "0") { throw "'gradle build' has failed" }
|
if ($lastExitCode -ne "0") { throw "Executing 'gradle build' exited with error code $lastExitCode" }
|
||||||
|
|
||||||
& gradle test
|
& gradle test
|
||||||
if ($lastExitCode -ne "0") { throw "'gradle test' has failed" }
|
if ($lastExitCode -ne "0") { throw "Executing 'gradle test' exited with error code $lastExitCode" }
|
||||||
|
|
||||||
} elseif (Test-Path "$path/meson.build" -pathType leaf) {
|
} elseif (Test-Path "$path/meson.build" -pathType leaf) {
|
||||||
"⏳ Building 📂$dirName by using Meson..."
|
"⏳ Building 📂$dirName by using Meson..."
|
||||||
Set-Location "$path"
|
Set-Location "$path"
|
||||||
& meson . build --prefix=/usr/local
|
& meson . build --prefix=/usr/local
|
||||||
if ($lastExitCode -ne "0") { throw "'meson . build' has failed" }
|
if ($lastExitCode -ne "0") { throw "Executing 'meson . build' exited with error code $lastExitCode" }
|
||||||
|
|
||||||
} elseif (Test-Path "$path/Imakefile" -pathType leaf) {
|
} elseif (Test-Path "$path/Imakefile" -pathType leaf) {
|
||||||
"⏳ Building 📂$dirName by using Imakefile..."
|
"⏳ Building 📂$dirName by using Imakefile..."
|
||||||
@ -152,7 +156,7 @@ function BuildInDir([string]$path) {
|
|||||||
Set-Location "$path/"
|
Set-Location "$path/"
|
||||||
|
|
||||||
& ./compile.sh
|
& ./compile.sh
|
||||||
if ($lastExitCode -ne "0") { throw "Script 'compile.sh' exited with error code $lastExitCode" }
|
if ($lastExitCode -ne "0") { throw "Executing './compile.sh' exited with error code $lastExitCode" }
|
||||||
|
|
||||||
& make -j4
|
& make -j4
|
||||||
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
|
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
|
||||||
@ -162,7 +166,7 @@ function BuildInDir([string]$path) {
|
|||||||
Set-Location "$path/attower/src/build/DevBuild/"
|
Set-Location "$path/attower/src/build/DevBuild/"
|
||||||
|
|
||||||
& ./build.bat build-all-release
|
& ./build.bat build-all-release
|
||||||
if ($lastExitCode -ne "0") { throw "Script 'build.bat' exited with error code $lastExitCode" }
|
if ($lastExitCode -ne "0") { throw "Executing 'build.bat build-all-release' exited with error code $lastExitCode" }
|
||||||
|
|
||||||
} elseif (Test-Path "$path/$dirName" -pathType container) {
|
} elseif (Test-Path "$path/$dirName" -pathType container) {
|
||||||
"⏳ No make rule found, trying subfolder 📂$($dirName)..."
|
"⏳ No make rule found, trying subfolder 📂$($dirName)..."
|
||||||
@ -192,4 +196,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of build-repo.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of build-repo.ps1 as of 05/19/2024 10:25:16)*
|
||||||
|
@ -82,4 +82,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of build-repos.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of build-repos.ps1 as of 05/19/2024 10:25:16)*
|
||||||
|
@ -60,4 +60,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-autostart.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-autostart.ps1 as of 05/19/2024 10:25:16)*
|
||||||
|
@ -63,4 +63,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-crashdumps.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-crashdumps.ps1 as of 05/19/2024 10:25:16)*
|
||||||
|
@ -64,4 +64,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-desktop.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-desktop.ps1 as of 05/19/2024 10:25:16)*
|
||||||
|
@ -64,4 +64,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-docs.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-docs.ps1 as of 05/19/2024 10:25:16)*
|
||||||
|
@ -64,4 +64,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-downloads.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-downloads.ps1 as of 05/19/2024 10:25:16)*
|
||||||
|
@ -60,4 +60,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-dropbox.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-dropbox.ps1 as of 05/19/2024 10:25:16)*
|
||||||
|
@ -64,4 +64,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-etc.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-etc.ps1 as of 05/19/2024 10:25:16)*
|
||||||
|
@ -60,4 +60,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-fonts.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-fonts.ps1 as of 05/19/2024 10:25:16)*
|
||||||
|
@ -60,4 +60,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-home.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-home.ps1 as of 05/19/2024 10:25:16)*
|
||||||
|
@ -48,4 +48,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-logs.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-logs.ps1 as of 05/19/2024 10:25:16)*
|
||||||
|
@ -64,4 +64,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-music.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-music.ps1 as of 05/19/2024 10:25:16)*
|
||||||
|
@ -60,4 +60,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-onedrive.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-onedrive.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -62,4 +62,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-pics.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-pics.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -62,4 +62,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-public.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-public.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -19,7 +19,7 @@ Script Content
|
|||||||
```powershell
|
```powershell
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Sets the working directory to the user's recycle bin folder
|
Sets the working directory to the recycle bin folder
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script changes the working directory to the user's recycle bin folder.
|
This PowerShell script changes the working directory to the user's recycle bin folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
@ -39,13 +39,13 @@ function GetCurrentUserSID { [CmdletBinding()] param()
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
$Path = "$HOME/.local/share/Trash/"
|
$path = "$HOME/.local/share/Trash/"
|
||||||
} else {
|
} else {
|
||||||
$Path = "C:\$Recycle.Bin\" + "$(GetCurrentUserSID)"
|
$path = "C:\`$Recycle.Bin\$(GetCurrentUserSID)"
|
||||||
}
|
}
|
||||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Recycle bin folder at 📂$Path doesn't exist (yet)" }
|
if (-not(Test-Path "$path" -pathType container)) { throw "Recycle bin folder at 📂$path doesn't exist (yet)" }
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -53,4 +53,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-recycle-bin.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-recycle-bin.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
93
docs/cd-repo.md
Normal file
93
docs/cd-repo.md
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
Script: *cd-repo.ps1*
|
||||||
|
========================
|
||||||
|
|
||||||
|
This PowerShell script changes the working directory to a Git repository.
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
```powershell
|
||||||
|
PS> ./cd-repo.ps1 [[-folderName] <String>] [<CommonParameters>]
|
||||||
|
|
||||||
|
-folderName <String>
|
||||||
|
Specifies the folder name
|
||||||
|
|
||||||
|
Required? false
|
||||||
|
Position? 1
|
||||||
|
Default value
|
||||||
|
Accept pipeline input? false
|
||||||
|
Accept wildcard characters? false
|
||||||
|
|
||||||
|
[<CommonParameters>]
|
||||||
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
|
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
|
||||||
|
```
|
||||||
|
|
||||||
|
Example
|
||||||
|
-------
|
||||||
|
```powershell
|
||||||
|
PS> ./cd-repo.ps1 rust
|
||||||
|
📂C:\Repos\rust • on Git branch: ## main ... origin/main
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Notes
|
||||||
|
-----
|
||||||
|
Author: Markus Fleschutz | License: CC0
|
||||||
|
|
||||||
|
Related Links
|
||||||
|
-------------
|
||||||
|
https://github.com/fleschutz/PowerShell
|
||||||
|
|
||||||
|
Script Content
|
||||||
|
--------------
|
||||||
|
```powershell
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Sets the working directory to a repository
|
||||||
|
.DESCRIPTION
|
||||||
|
This PowerShell script changes the working directory to a Git repository.
|
||||||
|
.PARAMETER folderName
|
||||||
|
Specifies the folder name
|
||||||
|
.EXAMPLE
|
||||||
|
PS> ./cd-repo.ps1 rust
|
||||||
|
📂C:\Repos\rust • on Git branch: ## main ... origin/main
|
||||||
|
.LINK
|
||||||
|
https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES
|
||||||
|
Author: Markus Fleschutz | License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param([string]$folderName = "")
|
||||||
|
|
||||||
|
try {
|
||||||
|
if ("$folderName" -eq "") { $folderName = Read-Host "Enter the folder name" }
|
||||||
|
|
||||||
|
if (Test-Path "$HOME/Repos/" -pathType Container) { # try short name
|
||||||
|
$path = "$HOME/Repos/"
|
||||||
|
} elseif (Test-Path "$HOME/repos/" -pathType Container) {
|
||||||
|
$path = "$HOME/repos/"
|
||||||
|
} elseif (Test-Path "$HOME/Repositories/" -pathType Container) { # try long name
|
||||||
|
$path = "$HOME/Repositories/"
|
||||||
|
} elseif (Test-Path "$HOME/source/repos/" -pathType Container) { # try Visual Studio default
|
||||||
|
$path = "$HOME/source/repos/"
|
||||||
|
} elseif (Test-Path "/Repos/" -pathType Container) {
|
||||||
|
$path = "/Repos/"
|
||||||
|
} else {
|
||||||
|
throw "The folder for Git repositories doesn't exist (yet)"
|
||||||
|
}
|
||||||
|
$path += $folderName
|
||||||
|
|
||||||
|
if (-not(Test-Path "$path" -pathType Container)) { throw "The path to 📂$path doesn't exist (yet)" }
|
||||||
|
$path = Resolve-Path "$path"
|
||||||
|
Set-Location "$path"
|
||||||
|
Write-Host "📂$path • on Git branch: " -noNewline
|
||||||
|
|
||||||
|
& git status --short --branch --show-stash
|
||||||
|
exit 0 # success
|
||||||
|
} catch {
|
||||||
|
"⚠️ Error: $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-repo.ps1 as of 05/19/2024 10:25:17)*
|
@ -6,16 +6,7 @@ This PowerShell script changes the working directory to the user's Git repositor
|
|||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-repos.ps1 [[-subpath] <String>] [<CommonParameters>]
|
PS> ./cd-repos.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
-subpath <String>
|
|
||||||
Specifies an additional relative subpath (optional)
|
|
||||||
|
|
||||||
Required? false
|
|
||||||
Position? 1
|
|
||||||
Default value
|
|
||||||
Accept pipeline input? false
|
|
||||||
Accept wildcard characters? false
|
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -25,15 +16,9 @@ PS> ./cd-repos.ps1 [[-subpath] <String>] [<CommonParameters>]
|
|||||||
Example
|
Example
|
||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-repos
|
PS> ./cd-repos.ps1
|
||||||
📂C:\Users\Markus\Repos
|
📂C:\Users\Markus\Repos
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PS> ./cd-repos rust
|
|
||||||
📂C:\Users\Markus\Repos\rust
|
|
||||||
on branch: ## main ... origin/main
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Notes
|
Notes
|
||||||
@ -55,20 +40,14 @@ Script Content
|
|||||||
.PARAMETER subpath
|
.PARAMETER subpath
|
||||||
Specifies an additional relative subpath (optional)
|
Specifies an additional relative subpath (optional)
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-repos
|
PS> ./cd-repos.ps1
|
||||||
📂C:\Users\Markus\Repos
|
📂C:\Users\Markus\Repos
|
||||||
|
|
||||||
PS> ./cd-repos rust
|
|
||||||
📂C:\Users\Markus\Repos\rust
|
|
||||||
on branch: ## main ... origin/main
|
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz | License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param([string]$subpath = "")
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (Test-Path "$HOME/Repos/" -pathType Container) { # try short name
|
if (Test-Path "$HOME/Repos/" -pathType Container) { # try short name
|
||||||
$path = "$HOME/Repos/"
|
$path = "$HOME/Repos/"
|
||||||
@ -83,16 +62,10 @@ try {
|
|||||||
} else {
|
} else {
|
||||||
throw "The folder for Git repositories 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)" }
|
if (-not(Test-Path "$path" -pathType Container)) { throw "The path to 📂$path doesn't exist (yet)" }
|
||||||
$path = Resolve-Path "$path"
|
$path = Resolve-Path "$path"
|
||||||
Set-Location "$path"
|
Set-Location "$path"
|
||||||
"📂$path"
|
"📂$path"
|
||||||
|
|
||||||
if ("$subpath" -ne "") {
|
|
||||||
Write-Host -noNewline " on branch: "
|
|
||||||
& git status --short --branch --show-stash
|
|
||||||
}
|
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error: $($Error[0])"
|
"⚠️ Error: $($Error[0])"
|
||||||
@ -100,4 +73,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-repos.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-repos.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -57,4 +57,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-root.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-root.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -55,4 +55,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-screenshots.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-screenshots.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -58,4 +58,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-scripts.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-scripts.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -58,4 +58,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-ssh.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-ssh.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -50,4 +50,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-temp.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-temp.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -62,4 +62,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-templates.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-templates.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -19,7 +19,7 @@ Script Content
|
|||||||
```powershell
|
```powershell
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Sets the working directory to the user's trash folder
|
Sets the working directory to the trash folder
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script changes the working directory to the user's trash folder.
|
This PowerShell script changes the working directory to the user's trash folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
@ -39,13 +39,13 @@ function GetCurrentUserSID { [CmdletBinding()] param()
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
$Path = "$HOME/.local/share/Trash/"
|
$path = "$HOME/.local/share/Trash/"
|
||||||
} else {
|
} else {
|
||||||
$Path = "C:\$Recycle.Bin\" + "$(GetCurrentUserSID)"
|
$path = "C:\`$Recycle.Bin\$(GetCurrentUserSID)"
|
||||||
}
|
}
|
||||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Trash folder at 📂$Path doesn't exist (yet)" }
|
if (-not(Test-Path "$path" -pathType container)) { throw "Trash folder at 📂$path doesn't exist (yet)" }
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -53,4 +53,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-trash.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-trash.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -58,4 +58,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -58,4 +58,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up2.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up2.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -58,4 +58,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up3.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up3.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -58,4 +58,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up4.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up4.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -58,4 +58,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-users.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-users.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -62,4 +62,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-videos.ps1 as of 03/27/2024 17:36:23)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-videos.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -58,4 +58,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-windows.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of cd-windows.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -79,4 +79,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of change-wallpaper.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of change-wallpaper.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -67,4 +67,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-admin.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-admin.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -1,34 +1,19 @@
|
|||||||
Script: *check-apps.ps1*
|
Script: *check-apps.ps1*
|
||||||
========================
|
========================
|
||||||
|
|
||||||
This PowerShell script queries the installed applications and prints it.
|
check-apps.ps1
|
||||||
|
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-apps.ps1 [<CommonParameters>]
|
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
|
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
|
||||||
```
|
```
|
||||||
|
|
||||||
Example
|
|
||||||
-------
|
|
||||||
```powershell
|
|
||||||
PS> ./check-apps.ps1
|
|
||||||
✅ 119 Windows apps installed, 11 upgrades available
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
Notes
|
|
||||||
-----
|
|
||||||
Author: Markus Fleschutz | License: CC0
|
|
||||||
|
|
||||||
Related Links
|
|
||||||
-------------
|
|
||||||
https://github.com/fleschutz/PowerShell
|
|
||||||
|
|
||||||
Script Content
|
Script Content
|
||||||
--------------
|
--------------
|
||||||
```powershell
|
```powershell
|
||||||
@ -46,28 +31,43 @@ Script Content
|
|||||||
Author: Markus Fleschutz | License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
|
function GetCrashDumps {
|
||||||
|
[string]$path = Resolve-Path -Path "~\AppData\Local\CrashDumps"
|
||||||
|
$count = 0
|
||||||
|
$files = (Get-ChildItem -path "$path\*.dmp" -attributes !Directory)
|
||||||
|
foreach($file in $files) { $count++ }
|
||||||
|
return $count
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
$statusIcon = "✅"
|
||||||
|
$statusMsg = ""
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
Write-Progress "Querying installed applications..."
|
Write-Progress "Querying installed applications..."
|
||||||
$numPkgs = (apt list --installed 2>/dev/null).Count
|
$numPkgs = (apt list --installed 2>/dev/null).Count
|
||||||
$numSnaps = (snap list).Count - 1
|
$numSnaps = (snap list).Count - 1
|
||||||
Write-Progress -Completed "."
|
Write-Progress -completed "Done."
|
||||||
Write-Host "✅ $numPkgs Debian packages, $numSnaps snaps installed"
|
$statusMsg += "$numPkgs Debian packages, $numSnaps snaps installed"
|
||||||
} else {
|
} else {
|
||||||
Write-Progress "Querying installed applications..."
|
Write-Progress "Querying installed apps..."
|
||||||
$Apps = Get-AppxPackage
|
$Apps = Get-AppxPackage
|
||||||
Write-Progress -Completed "."
|
Write-Progress -completed "Done."
|
||||||
Write-Host "✅ $($Apps.Count) Windows apps installed, " -noNewline
|
$statusMsg = "$($Apps.Count) Win apps installed"
|
||||||
|
|
||||||
[int]$NumNonOk = 0
|
[int]$numNonOk = 0
|
||||||
foreach($App in $Apps) { if ($App.Status -ne "Ok") { $NumNonOk++ } }
|
foreach($App in $Apps) { if ($App.Status -ne "Ok") { $numNonOk++ } }
|
||||||
if ($NumNonOk -gt 0) { $Status += ", $NumNonOk non-ok" }
|
if ($numNonOk -gt 0) { $statusIcon = "⚠️"; $statusMsg += ", $numNonOk non-ok" }
|
||||||
[int]$NumErrors = (Get-AppxLastError)
|
|
||||||
if ($NumErrors -gt 0) { $Status += ", $NumErrors errors" }
|
|
||||||
|
|
||||||
$NumUpdates = (winget upgrade --include-unknown).Count - 5
|
[int]$numErrors = (Get-AppxLastError)
|
||||||
Write-Host "$NumUpdates upgrades available"
|
if ($numErrors -gt 0) { $statusIcon = "⚠️"; $statusMsg += ", $numErrors errors" }
|
||||||
|
|
||||||
|
$numUpdates = (winget upgrade --include-unknown).Count - 5
|
||||||
|
$statusMsg += ", $numUpdates upgrades available"
|
||||||
|
|
||||||
|
$crashDumps = GetCrashDumps
|
||||||
|
if ($crashDumps -ne 0) { $statusIcon = "⚠️"; $statusMsg += ", $crashDumps crash dumps found" }
|
||||||
}
|
}
|
||||||
|
Write-Host "$statusIcon $statusMsg"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -75,4 +75,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-apps.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-apps.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -76,4 +76,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-bios.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-bios.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -101,4 +101,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-cpu.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-cpu.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -82,4 +82,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-credentials.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-credentials.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -57,4 +57,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-day.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-day.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -73,4 +73,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-dns.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-dns.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -110,4 +110,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-drive-space.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-drive-space.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -100,4 +100,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-drives.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-drives.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -63,4 +63,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-dusk.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-dusk.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -61,4 +61,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-easter-sunday.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-easter-sunday.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -75,4 +75,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-file-system.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-file-system.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -170,4 +170,4 @@ function Check-Header { param( $path )
|
|||||||
Check-Header $Path
|
Check-Header $Path
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-file.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-file.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -65,4 +65,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-firewall.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-firewall.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -65,4 +65,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-gpu.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-gpu.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -52,8 +52,7 @@ Script Content
|
|||||||
Author: Markus Fleschutz | License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
" "
|
Write-Host "`n H A R D W A R E" -foregroundColor green
|
||||||
& "$PSScriptRoot/write-green.ps1" " H A R D W A R E"
|
|
||||||
& "$PSScriptRoot/check-cpu.ps1"
|
& "$PSScriptRoot/check-cpu.ps1"
|
||||||
& "$PSScriptRoot/check-ram.ps1"
|
& "$PSScriptRoot/check-ram.ps1"
|
||||||
& "$PSScriptRoot/check-gpu.ps1"
|
& "$PSScriptRoot/check-gpu.ps1"
|
||||||
@ -64,4 +63,4 @@ Script Content
|
|||||||
exit 0 # success
|
exit 0 # success
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-hardware.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-hardware.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -58,4 +58,4 @@ Script Content
|
|||||||
exit 0 # success
|
exit 0 # success
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-health.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-health.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -61,4 +61,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-independence-day.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-independence-day.ps1 as of 05/19/2024 10:25:17)*
|
||||||
|
@ -84,4 +84,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-ipv4-address.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-ipv4-address.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -98,4 +98,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-ipv6-address.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-ipv6-address.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -55,4 +55,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-iss-position.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-iss-position.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -87,4 +87,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-mac-address.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-mac-address.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -60,4 +60,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-midnight.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-midnight.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -57,4 +57,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-month.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-month.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -76,4 +76,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-moon-phase.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-moon-phase.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -54,8 +54,7 @@ Script Content
|
|||||||
Author: Markus Fleschutz | License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
" "
|
Write-Host "`n N E T W O R K" -foregroundColor green
|
||||||
& "$PSScriptRoot/write-green.ps1" " N E T W O R K"
|
|
||||||
& "$PSScriptRoot/ping-remote-hosts.ps1"
|
& "$PSScriptRoot/ping-remote-hosts.ps1"
|
||||||
& "$PSScriptRoot/check-firewall"
|
& "$PSScriptRoot/check-firewall"
|
||||||
& "$PSScriptRoot/check-dns.ps1"
|
& "$PSScriptRoot/check-dns.ps1"
|
||||||
@ -65,4 +64,4 @@ Script Content
|
|||||||
exit 0 # success
|
exit 0 # success
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-network.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-network.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -59,4 +59,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-noon.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-noon.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -73,4 +73,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-os.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-os.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -65,4 +65,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-outlook.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-outlook.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -94,4 +94,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-password.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-password.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -24,7 +24,7 @@ Script Content
|
|||||||
This PowerShell script queries pending operating system reboots and prints it.
|
This PowerShell script queries pending operating system reboots and prints it.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
./check-pending-reboot.ps1
|
./check-pending-reboot.ps1
|
||||||
✅ No pending system reboot
|
✅ No pending reboot
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -79,11 +79,11 @@ try {
|
|||||||
$Reason += ", '...\CurrentControlSet\Services\Netlogon' with 'AvoidSpnSet'"
|
$Reason += ", '...\CurrentControlSet\Services\Netlogon' with 'AvoidSpnSet'"
|
||||||
}
|
}
|
||||||
if ($Reason -ne "") {
|
if ($Reason -ne "") {
|
||||||
Write-Host "⚠️ Pending reboot (registry contains $($Reason.substring(2)))"
|
Write-Host "⚠️ Pending reboot (registry got $($Reason.substring(2)))"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($Reason -eq "") {
|
if ($Reason -eq "") {
|
||||||
Write-Host "✅ No pending system reboot"
|
Write-Host "✅ No pending reboot"
|
||||||
}
|
}
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
@ -92,4 +92,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-pending-reboot.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-pending-reboot.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -92,4 +92,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-power.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-power.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -59,4 +59,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-powershell.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-powershell.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -76,4 +76,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-ps1-file.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-ps1-file.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -98,4 +98,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-ram.ps1 as of 03/27/2024 17:36:24)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-ram.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
Script: *check-repo.ps1*
|
Script: *check-repo.ps1*
|
||||||
========================
|
========================
|
||||||
|
|
||||||
This PowerShell script verifies the integrity of a local Git repository.
|
This PowerShell script verifies the integrity of a local Git repository and performs maintenance tasks.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-repo.ps1 [[-RepoDir] <String>] [<CommonParameters>]
|
PS> ./check-repo.ps1 [[-pathToRepo] <String>] [<CommonParameters>]
|
||||||
|
|
||||||
-RepoDir <String>
|
-pathToRepo <String>
|
||||||
Specifies the path to the Git repository (current working directory by default)
|
Specifies the file path to the local Git repository (current working directory by default)
|
||||||
|
|
||||||
Required? false
|
Required? false
|
||||||
Position? 1
|
Position? 1
|
||||||
@ -27,11 +27,11 @@ Example
|
|||||||
```powershell
|
```powershell
|
||||||
PS> ./check-repo.ps1 C:\MyRepo
|
PS> ./check-repo.ps1 C:\MyRepo
|
||||||
⏳ (1/10) Searching for Git executable... git version 2.41.0.windows.3
|
⏳ (1/10) Searching for Git executable... git version 2.41.0.windows.3
|
||||||
⏳ (2/10) Checking local folder... 📂C:\MyRepo
|
⏳ (2/10) Checking local repository... 📂C:\MyRepo
|
||||||
⏳ (3/10) Querying remote URL... git@github.com:fleschutz/PowerShell.git
|
⏳ (3/10) Querying remote URL... git@github.com:fleschutz/PowerShell.git
|
||||||
⏳ (4/10) Querying current branch... main
|
⏳ (4/10) Querying current branch... main
|
||||||
⏳ (5/10) Fetching remote updates...
|
⏳ (5/10) Fetching remote updates... OK
|
||||||
⏳ (6/10) Querying latest tag... v0.8 (commit 02171a401d83b01a0cda0af426840b605e617f08)
|
⏳ (6/10) Querying latest tag... v0.8 (at commit 02171a401d83b01a0cda0af426840b605e617f08)
|
||||||
⏳ (7/10) Verifying data integrity...
|
⏳ (7/10) Verifying data integrity...
|
||||||
...
|
...
|
||||||
|
|
||||||
@ -50,19 +50,19 @@ Script Content
|
|||||||
```powershell
|
```powershell
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Checks a repo
|
Checks a Git repository
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script verifies the integrity of a local Git repository.
|
This PowerShell script verifies the integrity of a local Git repository and performs maintenance tasks.
|
||||||
.PARAMETER RepoDir
|
.PARAMETER pathToRepo
|
||||||
Specifies the path to the Git repository (current working directory by default)
|
Specifies the file path to the local Git repository (current working directory by default)
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-repo.ps1 C:\MyRepo
|
PS> ./check-repo.ps1 C:\MyRepo
|
||||||
⏳ (1/10) Searching for Git executable... git version 2.41.0.windows.3
|
⏳ (1/10) Searching for Git executable... git version 2.41.0.windows.3
|
||||||
⏳ (2/10) Checking local folder... 📂C:\MyRepo
|
⏳ (2/10) Checking local repository... 📂C:\MyRepo
|
||||||
⏳ (3/10) Querying remote URL... git@github.com:fleschutz/PowerShell.git
|
⏳ (3/10) Querying remote URL... git@github.com:fleschutz/PowerShell.git
|
||||||
⏳ (4/10) Querying current branch... main
|
⏳ (4/10) Querying current branch... main
|
||||||
⏳ (5/10) Fetching remote updates...
|
⏳ (5/10) Fetching remote updates... OK
|
||||||
⏳ (6/10) Querying latest tag... v0.8 (commit 02171a401d83b01a0cda0af426840b605e617f08)
|
⏳ (6/10) Querying latest tag... v0.8 (at commit 02171a401d83b01a0cda0af426840b605e617f08)
|
||||||
⏳ (7/10) Verifying data integrity...
|
⏳ (7/10) Verifying data integrity...
|
||||||
...
|
...
|
||||||
.LINK
|
.LINK
|
||||||
@ -71,17 +71,17 @@ Script Content
|
|||||||
Author: Markus Fleschutz | License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param([string]$RepoDir = "$PWD")
|
param([string]$pathToRepo = "$PWD")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||||
|
|
||||||
Write-Host "⏳ (1/10) Searching for Git executable... " -noNewline
|
Write-Host "⏳ (1/10) Searching for Git executable... " -noNewline
|
||||||
& git --version
|
& git --version
|
||||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||||
|
|
||||||
Write-Host "⏳ (2/10) Checking local folder... " -noNewline
|
Write-Host "⏳ (2/10) Checking local repository... " -noNewline
|
||||||
$FullPath = Resolve-Path "$RepoDir"
|
$FullPath = Resolve-Path "$pathToRepo"
|
||||||
if (!(Test-Path "$FullPath" -pathType Container)) { throw "Can't access folder: $FullPath" }
|
if (!(Test-Path "$FullPath" -pathType Container)) { throw "Can't access folder: $FullPath" }
|
||||||
"📂$FullPath"
|
"📂$FullPath"
|
||||||
|
|
||||||
@ -93,14 +93,15 @@ try {
|
|||||||
& git -C "$FullPath" branch --show-current
|
& git -C "$FullPath" branch --show-current
|
||||||
if ($lastExitCode -ne "0") { throw "'git branch --show-current' failed with exit code $lastExitCode" }
|
if ($lastExitCode -ne "0") { throw "'git branch --show-current' failed with exit code $lastExitCode" }
|
||||||
|
|
||||||
Write-Host "⏳ (5/10) Fetching remote updates..."
|
Write-Host "⏳ (5/10) Fetching remote updates... " -noNewline
|
||||||
& git -C "$FullPath" fetch
|
& git -C "$FullPath" fetch --all --recurse-submodules --tags --force --quiet
|
||||||
if ($lastExitCode -ne "0") { throw "'git fetch' failed with exit code $lastExitCode" }
|
if ($lastExitCode -ne "0") { throw "'git fetch' failed with exit code $lastExitCode" }
|
||||||
|
Write-Host "OK"
|
||||||
|
|
||||||
Write-Host "⏳ (6/10) Querying latest tag... " -noNewline
|
Write-Host "⏳ (6/10) Querying latest tag... " -noNewline
|
||||||
$LatestTagCommitID = (git -C "$FullPath" rev-list --tags --max-count=1)
|
$latestTagCommitID = (git -C "$FullPath" rev-list --tags --max-count=1)
|
||||||
$LatestTagName = (git -C "$FullPath" describe --tags $LatestTagCommitID)
|
$latestTagName = (git -C "$FullPath" describe --tags $latestTagCommitID)
|
||||||
Write-Host "$LatestTagName (commit $LatestTagCommitID)"
|
Write-Host "$latestTagName (at commit $latestTagCommitID)"
|
||||||
|
|
||||||
Write-Host "⏳ (7/10) Verifying data integrity..."
|
Write-Host "⏳ (7/10) Verifying data integrity..."
|
||||||
& git -C "$FullPath" fsck
|
& git -C "$FullPath" fsck
|
||||||
@ -118,9 +119,9 @@ try {
|
|||||||
& git -C "$FullPath" status
|
& git -C "$FullPath" status
|
||||||
if ($lastExitCode -ne "0") { throw "'git status --short' failed with exit code $lastExitCode" }
|
if ($lastExitCode -ne "0") { throw "'git status --short' failed with exit code $lastExitCode" }
|
||||||
|
|
||||||
$RepoDirName = (Get-Item "$FullPath").Name
|
$repoDirName = (Get-Item "$FullPath").Name
|
||||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||||
"✔️ Checked repo 📂$RepoDirName in $Elapsed sec"
|
"✔️ Checked repo 📂$repoDirName in $($elapsed)s."
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -128,4 +129,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-repo.ps1 as of 03/27/2024 17:36:25)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-repo.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Script: *check-repos.ps1*
|
Script: *check-repos.ps1*
|
||||||
========================
|
========================
|
||||||
|
|
||||||
This PowerShell script checks all Git repositories in a folder.
|
This PowerShell script verifies the data integrity of all Git repositories in a folder.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
@ -9,7 +9,7 @@ Parameters
|
|||||||
PS> ./check-repos.ps1 [[-parentDir] <String>] [<CommonParameters>]
|
PS> ./check-repos.ps1 [[-parentDir] <String>] [<CommonParameters>]
|
||||||
|
|
||||||
-parentDir <String>
|
-parentDir <String>
|
||||||
Specifies the path to the parent folder
|
Specifies the file path to the parent folder
|
||||||
|
|
||||||
Required? false
|
Required? false
|
||||||
Position? 1
|
Position? 1
|
||||||
@ -25,7 +25,11 @@ PS> ./check-repos.ps1 [[-parentDir] <String>] [<CommonParameters>]
|
|||||||
Example
|
Example
|
||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-repos.ps1 C:\MyRepos
|
PS> ./check-repos.ps1 C:\Repos
|
||||||
|
⏳ Checking parent folder 📂C:\Repos... 16 subfolders
|
||||||
|
⏳ Checking 📂rust repository (1/16)...
|
||||||
|
...
|
||||||
|
✔️ Checked all 16 Git repos in 📂C:\Repos in 356s.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -44,11 +48,15 @@ Script Content
|
|||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Checks Git repositories
|
Checks Git repositories
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script checks all Git repositories in a folder.
|
This PowerShell script verifies the data integrity of all Git repositories in a folder.
|
||||||
.PARAMETER parentDir
|
.PARAMETER parentDir
|
||||||
Specifies the path to the parent folder
|
Specifies the file path to the parent folder
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-repos.ps1 C:\MyRepos
|
PS> ./check-repos.ps1 C:\Repos
|
||||||
|
⏳ Checking parent folder 📂C:\Repos... 16 subfolders
|
||||||
|
⏳ Checking 📂rust repository (1/16)...
|
||||||
|
...
|
||||||
|
✔️ Checked all 16 Git repos in 📂C:\Repos in 356s.
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -61,20 +69,21 @@ try {
|
|||||||
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||||
|
|
||||||
$parentDirName = (Get-Item "$parentDir").Name
|
$parentDirName = (Get-Item "$parentDir").Name
|
||||||
"⏳ Step 1 - Checking parent folder 📂$parentDirName..."
|
Write-Host "⏳ Checking parent folder 📂$parentDir... " -noNewline
|
||||||
if (-not(Test-Path "$parentDir" -pathType container)) { throw "Can't access folder: $parentDir" }
|
if (-not(Test-Path "$parentDir" -pathType container)) { throw "Can't access folder: $parentDir" }
|
||||||
$folders = (Get-ChildItem "$parentDir" -attributes Directory)
|
$folders = (Get-ChildItem "$parentDir" -attributes Directory)
|
||||||
$numFolders = $folders.Count
|
$numFolders = $folders.Count
|
||||||
"Found $numFolders subfolders."
|
"$numFolders subfolders"
|
||||||
|
|
||||||
[int]$Step = 1
|
[int]$step = 1
|
||||||
foreach ($folder in $folders) {
|
foreach ($folder in $folders) {
|
||||||
|
"`n⏳ Checking 📂$folder repository ($step/$numFolders)..."
|
||||||
& "$PSScriptRoot/check-repo.ps1" "$folder"
|
& "$PSScriptRoot/check-repo.ps1" "$folder"
|
||||||
$Step++
|
$step++
|
||||||
}
|
}
|
||||||
|
|
||||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||||
"✔️ Checked $numFolders Git repos at 📂$parentDirName in $elapsed sec"
|
"✔️ Checked all $numFolders Git repos in 📂$parentDir in $($elapsed)s."
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -82,4 +91,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-repos.ps1 as of 03/27/2024 17:36:25)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-repos.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -56,4 +56,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-santa.ps1 as of 03/27/2024 17:36:25)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-santa.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -24,70 +24,91 @@ Script Content
|
|||||||
This PowerShell script queries the status of the SSD/HDD devices (supporting S.M.A.R.T.) and prints it.
|
This PowerShell script queries the status of the SSD/HDD devices (supporting S.M.A.R.T.) and prints it.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-smart-devices.ps1
|
PS> ./check-smart-devices.ps1
|
||||||
✅ 1TB Samsung SSD 970 EVO via NVMe (2388 hours, 289x on, v2B2QEXE7, 37°C, selftest passed)
|
✅ 1TB Samsung SSD 970 EVO via NVMe (37°C, 2388 hours, 289x on/off, v2B2QEXE7, selftest passed)
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz | License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Bytes2String { param([int64]$Bytes)
|
function Bytes2String([int64]$bytes) {
|
||||||
if ($Bytes -lt 1000) { return "$Bytes bytes" }
|
if ($bytes -lt 1000) { return "$bytes bytes" }
|
||||||
$Bytes /= 1000
|
$bytes /= 1000
|
||||||
if ($Bytes -lt 1000) { return "$($Bytes)KB" }
|
if ($bytes -lt 1000) { return "$($bytes)KB" }
|
||||||
$Bytes /= 1000
|
$bytes /= 1000
|
||||||
if ($Bytes -lt 1000) { return "$($Bytes)MB" }
|
if ($bytes -lt 1000) { return "$($bytes)MB" }
|
||||||
$Bytes /= 1000
|
$bytes /= 1000
|
||||||
if ($Bytes -lt 1000) { return "$($Bytes)GB" }
|
if ($bytes -lt 1000) { return "$($bytes)GB" }
|
||||||
$Bytes /= 1000
|
$bytes /= 1000
|
||||||
if ($Bytes -lt 1000) { return "$($Bytes)TB" }
|
if ($bytes -lt 1000) { return "$($bytes)TB" }
|
||||||
$Bytes /= 1000
|
$bytes /= 1000
|
||||||
if ($Bytes -lt 1000) { return "$($Bytes)PB" }
|
if ($bytes -lt 1000) { return "$($bytes)PB" }
|
||||||
$Bytes /= 1000
|
$bytes /= 1000
|
||||||
if ($Bytes -lt 1000) { return "$($Bytes)EB" }
|
if ($bytes -lt 1000) { return "$($bytes)EB" }
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Write-Progress "(1/3) Searching for smartmontools..."
|
Write-Progress "(1/3) Searching for smartmontools..."
|
||||||
$Result = (smartctl --version)
|
$result = (smartctl --version)
|
||||||
if ($lastExitCode -ne "0") { throw "Can't execute 'smartctl' - make sure smartmontools are installed" }
|
if ($lastExitCode -ne "0") { throw "Can't execute 'smartctl' - make sure smartmontools are installed" }
|
||||||
|
|
||||||
Write-Progress "(2/3) Scanning S.M.A.R.T devices..."
|
Write-Progress "(2/3) Scanning S.M.A.R.T devices..."
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
$Devices = $(sudo smartctl --scan-open)
|
$devices = $(sudo smartctl --scan-open)
|
||||||
} else {
|
} else {
|
||||||
$Devices = $(smartctl --scan-open)
|
$devices = $(smartctl --scan-open)
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($Device in $Devices) {
|
|
||||||
Write-Progress "(3/3) Querying S.M.A.R.T devices..."
|
Write-Progress "(3/3) Querying S.M.A.R.T devices..."
|
||||||
$Array = $Device.split(" ")
|
foreach($device in $devices) {
|
||||||
$Device = $Array[0]
|
$array = $device.split(" ")
|
||||||
if ("$Device" -eq "#") {
|
$dev = $array[0]
|
||||||
|
if ("$dev" -eq "#") {
|
||||||
continue
|
continue
|
||||||
} elseif ($IsLinux) {
|
} elseif ($IsLinux) {
|
||||||
$Details = (sudo smartctl --all --json $Device) | ConvertFrom-Json
|
$details = (sudo smartctl --all --json $dev) | ConvertFrom-Json
|
||||||
$null = (sudo smartctl --test=short $Device)
|
$null = (sudo smartctl --test=conveyance $dev)
|
||||||
} else {
|
} else {
|
||||||
$Details = (smartctl --all --json $Device) | ConvertFrom-Json
|
$details = (smartctl --all --json $dev) | ConvertFrom-Json
|
||||||
$null = (smartctl --test=short $Device)
|
$null = (smartctl --test=conveyance $dev)
|
||||||
}
|
}
|
||||||
$ModelName = $Details.model_name
|
$status = "✅"
|
||||||
$Protocol = $Details.device.protocol
|
$modelName = $details.model_name
|
||||||
[int64]$GBytes = $Details.user_capacity.bytes
|
$protocol = $details.device.protocol
|
||||||
if ($GBytes -gt 0) {
|
[int64]$bytes = $details.user_capacity.bytes
|
||||||
$Capacity = "$(Bytes2String $GBytes) "
|
if ($bytes -gt 0) {
|
||||||
|
$capacity = "$(Bytes2String $bytes) "
|
||||||
} else {
|
} else {
|
||||||
$Capacity = ""
|
$capacity = ""
|
||||||
|
}
|
||||||
|
if ($details.temperature.current -gt 50) {
|
||||||
|
$temp = "$($details.temperature.current)°C (!)"
|
||||||
|
$status = "⚠️"
|
||||||
|
} else {
|
||||||
|
$temp = "$($details.temperature.current)°C"
|
||||||
|
}
|
||||||
|
if ($details.power_on_time.hours -gt 87600) { # 10 years
|
||||||
|
$hours = "$($details.power_on_time.hours) hours (!)"
|
||||||
|
$status = "⚠️"
|
||||||
|
} else {
|
||||||
|
$hours = "$($details.power_on_time.hours) hours"
|
||||||
|
}
|
||||||
|
if ($details.power_cycle_count -gt 100000) {
|
||||||
|
$powerOn = "$($details.power_cycle_count)x on/off (!)"
|
||||||
|
$status = "⚠️"
|
||||||
|
} else {
|
||||||
|
$powerOn = "$($details.power_cycle_count)x on/off"
|
||||||
|
}
|
||||||
|
if ($details.smart_status.passed) {
|
||||||
|
$selftest = "selftest passed"
|
||||||
|
} else {
|
||||||
|
$selftest = "selftest FAILED"
|
||||||
|
$status = "⚠️"
|
||||||
|
}
|
||||||
|
$firmwareVersion = $details.firmware_version
|
||||||
|
Write-Host "$status $capacity$modelName via $protocol ($temp, $hours, $powerOn, $selftest, v$firmwareVersion)"
|
||||||
}
|
}
|
||||||
$Temp = $Details.temperature.current
|
|
||||||
$Firmware = $Details.firmware_version
|
|
||||||
$PowerOn = $Details.power_cycle_count
|
|
||||||
$Hours = $Details.power_on_time.hours
|
|
||||||
if ($Details.smart_status.passed) { $Status = "passed" } else { $Status = "FAILED" }
|
|
||||||
Write-Progress -completed " "
|
Write-Progress -completed " "
|
||||||
Write-Host "✅ $($Capacity)$ModelName via $Protocol ($Hours hours, $($PowerOn)x on, v$($Firmware), $($Temp)°C, selftest $Status)"
|
|
||||||
}
|
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -95,4 +116,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-smart-devices.ps1 as of 03/27/2024 17:36:25)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-smart-devices.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -54,8 +54,7 @@ Script Content
|
|||||||
Author: Markus Fleschutz | License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
" "
|
Write-Host "`n S O F T W A R E" -foregroundColor green
|
||||||
& "$PSScriptRoot/write-green.ps1" " S O F T W A R E"
|
|
||||||
& "$PSScriptRoot/check-os.ps1"
|
& "$PSScriptRoot/check-os.ps1"
|
||||||
& "$PSScriptRoot/check-uptime.ps1"
|
& "$PSScriptRoot/check-uptime.ps1"
|
||||||
& "$PSScriptRoot/check-apps.ps1"
|
& "$PSScriptRoot/check-apps.ps1"
|
||||||
@ -66,4 +65,4 @@ Script Content
|
|||||||
exit 0 # success
|
exit 0 # success
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-software.ps1 as of 03/27/2024 17:36:25)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-software.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -84,4 +84,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-subnet-mask.ps1 as of 03/27/2024 17:36:25)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-subnet-mask.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -95,7 +95,7 @@ try {
|
|||||||
} elseif ($free -lt $minLevel) {
|
} elseif ($free -lt $minLevel) {
|
||||||
Write-Output "⚠️ Swap space has only $(MB2String $free) of $(MB2String $total) free"
|
Write-Output "⚠️ Swap space has only $(MB2String $free) of $(MB2String $total) free"
|
||||||
} elseif ($used -lt 5) {
|
} elseif ($used -lt 5) {
|
||||||
Write-Output "✅ Swap space has the full $(MB2String $free) free"
|
Write-Output "✅ Swap space has all $(MB2String $free) free"
|
||||||
} else {
|
} else {
|
||||||
[int64]$percent = ($used * 100) / $total
|
[int64]$percent = ($used * 100) / $total
|
||||||
Write-Output "✅ Swap space has $(MB2String $free) free ($percent% of $(MB2String $total) used)"
|
Write-Output "✅ Swap space has $(MB2String $free) free ($percent% of $(MB2String $total) used)"
|
||||||
@ -107,4 +107,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-swap-space.ps1 as of 03/27/2024 17:36:25)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-swap-space.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -100,4 +100,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-symlinks.ps1 as of 03/27/2024 17:36:25)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-symlinks.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -65,4 +65,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-time-zone.ps1 as of 03/27/2024 17:36:25)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-time-zone.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -61,4 +61,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-uptime.ps1 as of 03/27/2024 17:36:25)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-uptime.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -51,9 +51,9 @@ try {
|
|||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
# TODO
|
# TODO
|
||||||
} else {
|
} else {
|
||||||
$Connections = Get-VPNConnection
|
$connections = Get-VPNConnection
|
||||||
foreach($Connection in $Connections) {
|
foreach($connection in $connections) {
|
||||||
Write-Host "✅ VPN to $($Connection.Name) is $($Connection.ConnectionStatus.ToLower())"
|
Write-Host "✅ VPN to $($connection.Name) is $($connection.ConnectionStatus.ToLower())"
|
||||||
$noVPN = $false
|
$noVPN = $false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,4 +65,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-vpn.ps1 as of 03/27/2024 17:36:25)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-vpn.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -81,4 +81,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-weather.ps1 as of 03/27/2024 17:36:25)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-weather.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -54,4 +54,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-week.ps1 as of 03/27/2024 17:36:25)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-week.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -72,4 +72,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-wind.ps1 as of 03/27/2024 17:36:25)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-wind.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -60,4 +60,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-windows-system-files.ps1 as of 03/27/2024 17:36:25)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-windows-system-files.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -85,4 +85,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-xml-file.ps1 as of 03/27/2024 17:36:25)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-xml-file.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -83,4 +83,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-xml-files.ps1 as of 03/27/2024 17:36:25)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of check-xml-files.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -31,7 +31,7 @@ PS> ./clean-repo.ps1 C:\rust
|
|||||||
⏳ (2/4) Checking local repository... 📂C:\rust
|
⏳ (2/4) Checking local repository... 📂C:\rust
|
||||||
⏳ (3/4) Removing untracked files in repository...
|
⏳ (3/4) Removing untracked files in repository...
|
||||||
⏳ (4/4) Removing untracked files in submodules...
|
⏳ (4/4) Removing untracked files in submodules...
|
||||||
✔️ Cleaned up 📂rust repository in 1 sec.
|
✔️ Repo 📂rust is clean now (took 1s).
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ Script Content
|
|||||||
⏳ (2/4) Checking local repository... 📂C:\rust
|
⏳ (2/4) Checking local repository... 📂C:\rust
|
||||||
⏳ (3/4) Removing untracked files in repository...
|
⏳ (3/4) Removing untracked files in repository...
|
||||||
⏳ (4/4) Removing untracked files in submodules...
|
⏳ (4/4) Removing untracked files in submodules...
|
||||||
✔️ Cleaned up 📂rust repository in 1 sec.
|
✔️ Repo 📂rust is clean now (took 1s).
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -93,7 +93,7 @@ try {
|
|||||||
if ($lastExitCode -ne "0") { throw "'git clean' in the submodules failed with exit code $lastExitCode" }
|
if ($lastExitCode -ne "0") { throw "'git clean' in the submodules failed with exit code $lastExitCode" }
|
||||||
|
|
||||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||||
"✔️ Cleaned up 📂$repoName repository in $elapsed sec."
|
"✔️ Repo 📂$repoName is clean now (took $($elapsed)s)."
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -101,4 +101,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of clean-repo.ps1 as of 03/27/2024 17:36:25)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of clean-repo.ps1 as of 05/19/2024 10:25:18)*
|
||||||
|
@ -100,4 +100,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of clean-repos.ps1 as of 03/27/2024 17:36:25)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of clean-repos.ps1 as of 05/19/2024 10:25:19)*
|
||||||
|
@ -60,4 +60,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of clear-dns-cache.ps1 as of 03/27/2024 17:36:25)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of clear-dns-cache.ps1 as of 05/19/2024 10:25:19)*
|
||||||
|
@ -58,4 +58,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of clear-recycle-bin.ps1 as of 03/27/2024 17:36:25)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of clear-recycle-bin.ps1 as of 05/19/2024 10:25:19)*
|
||||||
|
@ -112,4 +112,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of clone-repos.ps1 as of 03/27/2024 17:36:25)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of clone-repos.ps1 as of 05/19/2024 10:25:19)*
|
||||||
|
@ -48,4 +48,4 @@ Stop-Process -name "CalculatorApp"
|
|||||||
exit 0 # success
|
exit 0 # success
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of close-calculator.ps1 as of 03/27/2024 17:36:25)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of close-calculator.ps1 as of 05/19/2024 10:25:19)*
|
||||||
|
@ -48,4 +48,4 @@ Script Content
|
|||||||
exit 0 # success
|
exit 0 # success
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of close-chrome.ps1 as of 03/27/2024 17:36:25)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of close-chrome.ps1 as of 05/19/2024 10:25:19)*
|
||||||
|
@ -48,4 +48,4 @@ Script Content
|
|||||||
exit 0 # success
|
exit 0 # success
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of close-cortana.ps1 as of 03/27/2024 17:36:25)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of close-cortana.ps1 as of 05/19/2024 10:25:19)*
|
||||||
|
@ -52,4 +52,4 @@ if ($lastExitCode -ne "0") {
|
|||||||
exit 0 # success
|
exit 0 # success
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of close-edge.ps1 as of 03/27/2024 17:36:25)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of close-edge.ps1 as of 05/19/2024 10:25:19)*
|
||||||
|
@ -48,4 +48,4 @@ Script Content
|
|||||||
exit 0 # success
|
exit 0 # success
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of close-file-explorer.ps1 as of 03/27/2024 17:36:25)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of close-file-explorer.ps1 as of 05/19/2024 10:25:19)*
|
||||||
|
@ -48,4 +48,4 @@ Script Content
|
|||||||
exit 0 # success
|
exit 0 # success
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of close-firefox.ps1 as of 03/27/2024 17:36:25)*
|
*(generated by convert-ps2md.ps1 using the comment-based help of close-firefox.ps1 as of 05/19/2024 10:25:19)*
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user