mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-23 08:23:14 +01:00
Updated the manuals
This commit is contained in:
parent
53eb60baa3
commit
54635c32da
@ -6,7 +6,7 @@ This PowerShell script adds firewall rules for the given executable. Administrat
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./add-firewall-rules.ps1 [[-PathToExecutables] <String>] [[-Direction] <String>] [[-FirewallProfile] <Array>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/add-firewall-rules.ps1 [[-PathToExecutables] <String>] [[-Direction] <String>] [[-FirewallProfile] <Array>] [<CommonParameters>]
|
||||
|
||||
-PathToExecutables <String>
|
||||
Specifies the path to the executables.
|
||||
@ -113,4 +113,4 @@ try {
|
||||
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of add-firewall-rules.ps1 as of 08/15/2024 09:50:44)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of add-firewall-rules.ps1 as of 11/08/2024 12:34:45)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script handles and escalates the given alert message.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./alert.ps1 [[-Message] <String>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/alert.ps1 [[-Message] <String>] [<CommonParameters>]
|
||||
|
||||
-Message <String>
|
||||
Specifies the alert message
|
||||
@ -71,4 +71,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of alert.ps1 as of 08/15/2024 09:50:44)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of alert.ps1 as of 11/08/2024 12:34:45)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script builds a Git repository by supporting build systems such
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./build-repo.ps1 [[-path] <String>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/build-repo.ps1 [[-path] <String>] [<CommonParameters>]
|
||||
|
||||
-path <String>
|
||||
Specifies the path to the Git repository (default is current working directory)
|
||||
@ -28,7 +28,7 @@ Example
|
||||
PS> ./build-repo.ps1 C:\Repos\ninja
|
||||
⏳ Building 📂ninja using CMakeLists.txt into 📂ninja/_Build_Results...
|
||||
...
|
||||
✔️ Built 📂ninja repository in 47 sec.
|
||||
✅ Built 📂ninja repository in 47 sec.
|
||||
|
||||
```
|
||||
|
||||
@ -54,7 +54,7 @@ Script Content
|
||||
PS> ./build-repo.ps1 C:\Repos\ninja
|
||||
⏳ Building 📂ninja using CMakeLists.txt into 📂ninja/_Build_Results...
|
||||
...
|
||||
✔️ Built 📂ninja repository in 47 sec.
|
||||
✅ Built 📂ninja repository in 47 sec.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -188,7 +188,7 @@ try {
|
||||
|
||||
$repoDirName = (Get-Item "$path").Name
|
||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||
"✔️ Built 📂$repoDirName repository in $elapsed sec."
|
||||
"✅ Built 📂$repoDirName repository in $elapsed sec."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -196,4 +196,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of build-repo.ps1 as of 08/15/2024 09:50:44)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of build-repo.ps1 as of 11/08/2024 12:34:45)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script builds all Git repositories in a folder.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./build-repos.ps1 [[-ParentDir] <String>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/build-repos.ps1 [[-ParentDir] <String>] [<CommonParameters>]
|
||||
|
||||
-ParentDir <String>
|
||||
Specifies the path to the parent folder
|
||||
@ -74,7 +74,7 @@ try {
|
||||
}
|
||||
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
"✔️ built $FolderCount Git repositories at 📂$ParentDirName in $Elapsed sec"
|
||||
"✅ Built $FolderCount Git repositories at 📂$ParentDirName in $Elapsed sec"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -82,4 +82,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of build-repos.ps1 as of 08/15/2024 09:50:44)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of build-repos.ps1 as of 11/08/2024 12:34:45)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script changes the working directory to the user's autostart fol
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./cd-autostart.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/cd-autostart.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -47,12 +47,12 @@ Script Content
|
||||
#>
|
||||
|
||||
try {
|
||||
$Path = Resolve-Path "$HOME/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup"
|
||||
if (-not(Test-Path "$Path" -pathType container)) {
|
||||
throw "Autostart folder at 📂$Path doesn't exist (yet)"
|
||||
$path = Resolve-Path "~/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup"
|
||||
if (-not(Test-Path "$path" -pathType container)) {
|
||||
throw "Autostart folder at 📂$path doesn't exist (yet)"
|
||||
}
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
Set-Location "$path"
|
||||
"📂$path"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -60,4 +60,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-autostart.ps1 as of 08/15/2024 09:50:44)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-autostart.ps1 as of 11/08/2024 12:34:45)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script changes the working directory to the crash dumps director
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./cd-crashdumps.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/cd-crashdumps.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -63,4 +63,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-crashdumps.ps1 as of 08/15/2024 09:50:44)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-crashdumps.ps1 as of 11/08/2024 12:34:45)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script changes the working directory to the user's desktop folde
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./cd-desktop.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/cd-desktop.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -48,20 +48,20 @@ Script Content
|
||||
|
||||
try {
|
||||
if ($IsLinux) {
|
||||
$Path = Resolve-Path "~/Desktop"
|
||||
$path = Resolve-Path "~/Desktop"
|
||||
} else {
|
||||
$Path = [Environment]::GetFolderPath('DesktopDirectory')
|
||||
$path = [Environment]::GetFolderPath('DesktopDirectory')
|
||||
}
|
||||
if (Test-Path "$Path" -pathType container) {
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
if (Test-Path "$path" -pathType container) {
|
||||
Set-Location "$path"
|
||||
"📂$path"
|
||||
exit 0 # success
|
||||
}
|
||||
throw "User's desktop folder at 📂$Path doesn't exist (yet)"
|
||||
throw "User's desktop folder at 📂$path doesn't exist (yet)"
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-desktop.ps1 as of 08/15/2024 09:50:44)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-desktop.ps1 as of 11/08/2024 12:34:45)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script changes the working directory to the documents folder.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./cd-docs.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/cd-docs.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -48,15 +48,15 @@ Script Content
|
||||
|
||||
try {
|
||||
if ($IsLinux) {
|
||||
$Path = Resolve-Path "$HOME/Documents"
|
||||
$path = Resolve-Path "~/Documents"
|
||||
} else {
|
||||
$Path = [Environment]::GetFolderPath('MyDocuments')
|
||||
$path = [Environment]::GetFolderPath('MyDocuments')
|
||||
}
|
||||
if (-not(Test-Path "$Path" -pathType container)) {
|
||||
throw "Documents folder at 📂$Path doesn't exist (yet)"
|
||||
if (-not(Test-Path "$path" -pathType container)) {
|
||||
throw "Documents folder at 📂$path doesn't exist (yet)"
|
||||
}
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
Set-Location "$path"
|
||||
"📂$path"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -64,4 +64,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-docs.ps1 as of 08/15/2024 09:50:44)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-docs.ps1 as of 11/08/2024 12:34:45)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script changes the working directory to the user's downloads fol
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./cd-downloads.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/cd-downloads.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -48,20 +48,20 @@ Script Content
|
||||
|
||||
try {
|
||||
if ($IsLinux) {
|
||||
$Path = Resolve-Path "~/Downloads"
|
||||
$path = Resolve-Path "~/Downloads"
|
||||
} else {
|
||||
$Path = (New-Object -ComObject Shell.Application).NameSpace('shell:Downloads').Self.Path
|
||||
$path = (New-Object -ComObject Shell.Application).NameSpace('shell:Downloads').Self.Path
|
||||
}
|
||||
if (Test-Path "$Path" -pathType container) {
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
if (Test-Path "$path" -pathType container) {
|
||||
Set-Location "$path"
|
||||
"📂$path"
|
||||
exit 0 # success
|
||||
}
|
||||
throw "User's downloads folder at 📂$Path doesn't exist (yet)"
|
||||
throw "User's downloads folder at 📂$path doesn't exist (yet)"
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-downloads.ps1 as of 08/15/2024 09:50:44)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-downloads.ps1 as of 11/08/2024 12:34:45)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script changes the working directory to the user's Dropbox folde
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./cd-dropbox.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/cd-dropbox.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -47,17 +47,15 @@ Script Content
|
||||
#>
|
||||
|
||||
try {
|
||||
$Path = Resolve-Path "$HOME/Dropbox"
|
||||
if (-not(Test-Path "$Path" -pathType container)) {
|
||||
throw "Dropbox folder at 📂$Path doesn't exist (yet)"
|
||||
}
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
$path = Resolve-Path "~/Dropbox"
|
||||
if (-not(Test-Path "$path" -pathType container)) { throw "No Dropbox folder at 📂$path - is Dropbox installed?" }
|
||||
Set-Location "$path"
|
||||
"📂$path"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
"⚠️ Error: $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-dropbox.ps1 as of 08/15/2024 09:50:44)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-dropbox.ps1 as of 11/08/2024 12:34:45)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script changes the working directory to the /etc directory.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./cd-etc.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/cd-etc.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -48,15 +48,15 @@ Script Content
|
||||
|
||||
try {
|
||||
if ($IsLinx) {
|
||||
$Path = "/etc"
|
||||
$path = "/etc"
|
||||
} else {
|
||||
$Path = Resolve-Path "$env:WINDIR\System32\drivers\etc"
|
||||
$path = Resolve-Path "$env:WINDIR\System32\drivers\etc"
|
||||
}
|
||||
if (-not(Test-Path "$Path" -pathType container)) {
|
||||
throw "/etc directory at 📂$Path doesn't exist (yet)"
|
||||
if (-not(Test-Path "$path" -pathType container)) {
|
||||
throw "/etc directory at 📂$path doesn't exist (yet)"
|
||||
}
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
Set-Location "$path"
|
||||
"📂$path"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -64,4 +64,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-etc.ps1 as of 08/15/2024 09:50:44)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-etc.ps1 as of 11/08/2024 12:34:45)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script changes the working directory to the fonts folder.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./cd-fonts.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/cd-fonts.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -47,12 +47,12 @@ Script Content
|
||||
#>
|
||||
|
||||
try {
|
||||
$Path = [Environment]::GetFolderPath('Fonts')
|
||||
if (-not(Test-Path "$Path" -pathType container)) {
|
||||
throw "Fonts folder at 📂$Path doesn't exist (yet)"
|
||||
$path = [Environment]::GetFolderPath('Fonts')
|
||||
if (-not(Test-Path "$path" -pathType container)) {
|
||||
throw "Fonts folder at 📂$path doesn't exist (yet)"
|
||||
}
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
Set-Location "$path"
|
||||
"📂$path"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -60,4 +60,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-fonts.ps1 as of 08/15/2024 09:50:44)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-fonts.ps1 as of 11/08/2024 12:34:45)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script changes the working directory to the user's home director
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./cd-home.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/cd-home.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -16,7 +16,7 @@ PS> ./cd-home.ps1 [<CommonParameters>]
|
||||
Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./cd-home
|
||||
PS> ./cd-home.ps1
|
||||
📂C:\Users\Markus
|
||||
|
||||
```
|
||||
@ -38,7 +38,7 @@ Script Content
|
||||
.DESCRIPTION
|
||||
This PowerShell script changes the working directory to the user's home directory.
|
||||
.EXAMPLE
|
||||
PS> ./cd-home
|
||||
PS> ./cd-home.ps1
|
||||
📂C:\Users\Markus
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
@ -47,17 +47,15 @@ Script Content
|
||||
#>
|
||||
|
||||
try {
|
||||
$Path = Resolve-Path -Path "~"
|
||||
if (Test-Path "$Path" -pathType container) {
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
exit 0 # success
|
||||
}
|
||||
throw "User's home folder at 📂$Path doesn't exist (yet)"
|
||||
$path = Resolve-Path "~"
|
||||
if (-not(Test-Path "$path" -pathType container)) { throw "Home folder at $path doesn't exist (yet)" }
|
||||
Set-Location "$path"
|
||||
"📂$path"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-home.ps1 as of 08/15/2024 09:50:44)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-home.ps1 as of 11/08/2024 12:34:45)*
|
||||
|
66
docs/cd-jenkins.md
Normal file
66
docs/cd-jenkins.md
Normal file
@ -0,0 +1,66 @@
|
||||
Script: *cd-jenkins.ps1*
|
||||
========================
|
||||
|
||||
This PowerShell script changes the working directory to the Jenkins home directory.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
/home/markus/Repos/PowerShell/scripts/cd-jenkins.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
|
||||
```
|
||||
|
||||
Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./cd-jenkins
|
||||
📂C:\Users\Markus\.jenkins
|
||||
|
||||
```
|
||||
|
||||
Notes
|
||||
-----
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
|
||||
Related Links
|
||||
-------------
|
||||
https://github.com/fleschutz/PowerShell
|
||||
|
||||
Script Content
|
||||
--------------
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Changes to the Jenkins home directory
|
||||
.DESCRIPTION
|
||||
This PowerShell script changes the working directory to the Jenkins home directory.
|
||||
.EXAMPLE
|
||||
PS> ./cd-jenkins
|
||||
📂C:\Users\Markus\.jenkins
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
if (Test-Path "~/.jenkins" -pathType container) {
|
||||
$path = "~/.jenkins"
|
||||
} elseif (Test-Path "/var/snap/jenkins" -pathType container) {
|
||||
$path = "/var/snap/jenkins"
|
||||
} else {
|
||||
throw "No Jenkins home directory found - is Jenkins installed?"
|
||||
}
|
||||
Set-Location "$path"
|
||||
"📂$path"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-jenkins.ps1 as of 11/08/2024 12:34:45)*
|
@ -38,9 +38,9 @@ function GetLogsDir {
|
||||
}
|
||||
|
||||
try {
|
||||
$Path = GetLogsDir
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
$path = GetLogsDir
|
||||
Set-Location "$path"
|
||||
"📂$path"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -48,4 +48,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-logs.ps1 as of 08/15/2024 09:50:44)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-logs.ps1 as of 11/08/2024 12:34:45)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script changes the working directory to the user's music folder.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./cd-music.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/cd-music.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -48,20 +48,20 @@ Script Content
|
||||
|
||||
try {
|
||||
if ($IsLinux) {
|
||||
$Path = Resolve-Path "~/Music"
|
||||
$path = Resolve-Path "~/Music"
|
||||
} else {
|
||||
$Path = [Environment]::GetFolderPath('MyMusic')
|
||||
$path = [Environment]::GetFolderPath('MyMusic')
|
||||
}
|
||||
if (Test-Path "$Path" -pathType container) {
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
if (Test-Path "$path" -pathType container) {
|
||||
Set-Location "$path"
|
||||
"📂$path"
|
||||
exit 0 # success
|
||||
}
|
||||
throw "User's music folder at 📂$Path doesn't exist (yet)"
|
||||
throw "User's music folder at 📂$path doesn't exist (yet)"
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-music.ps1 as of 08/15/2024 09:50:44)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-music.ps1 as of 11/08/2024 12:34:45)*
|
||||
|
61
docs/cd-nextcloud.md
Normal file
61
docs/cd-nextcloud.md
Normal file
@ -0,0 +1,61 @@
|
||||
Script: *cd-nextcloud.ps1*
|
||||
========================
|
||||
|
||||
This PowerShell script changes the working directory to the user's NextCloud folder.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
/home/markus/Repos/PowerShell/scripts/cd-nextcloud.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
|
||||
```
|
||||
|
||||
Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./cd-nextcloud
|
||||
📂C:\Users\Markus\NextCloud
|
||||
|
||||
```
|
||||
|
||||
Notes
|
||||
-----
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
|
||||
Related Links
|
||||
-------------
|
||||
https://github.com/fleschutz/PowerShell
|
||||
|
||||
Script Content
|
||||
--------------
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Sets the working directory to the user's NextCloud folder
|
||||
.DESCRIPTION
|
||||
This PowerShell script changes the working directory to the user's NextCloud folder.
|
||||
.EXAMPLE
|
||||
PS> ./cd-nextcloud
|
||||
📂C:\Users\Markus\NextCloud
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
$path = Resolve-Path "~/NextCloud"
|
||||
if (-not(Test-Path "$path" -pathType container)) { throw "No NextCloud folder at 📂$path - is NextCloud installed?" }
|
||||
Set-Location "$path"
|
||||
"📂$path"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-nextcloud.ps1 as of 11/08/2024 12:34:45)*
|
@ -6,7 +6,7 @@ This PowerShell script changes the working directory to the user's OneDrive fold
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./cd-onedrive.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/cd-onedrive.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -47,17 +47,15 @@ Script Content
|
||||
#>
|
||||
|
||||
try {
|
||||
$Path = Resolve-Path "$HOME/OneDrive"
|
||||
if (-not(Test-Path "$Path" -pathType container)) {
|
||||
throw "OneDrive folder at 📂$Path doesn't exist (yet)"
|
||||
}
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
$path = Resolve-Path "~/OneDrive"
|
||||
if (-not(Test-Path "$path" -pathType container)) { throw "No OneDrive folder at 📂$path - is OneDrive installed?" }
|
||||
Set-Location "$path"
|
||||
"📂$path"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
"⚠️ Error: $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-onedrive.ps1 as of 08/15/2024 09:50:44)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-onedrive.ps1 as of 11/08/2024 12:34:45)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script changes the working directory to the user's pictures fold
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./cd-pics.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/cd-pics.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -48,13 +48,13 @@ Script Content
|
||||
|
||||
try {
|
||||
if ($IsLinux) {
|
||||
$Path = Resolve-Path "$HOME/Pictures"
|
||||
$path = Resolve-Path "~/Pictures"
|
||||
} else {
|
||||
$Path = [Environment]::GetFolderPath('MyPictures')
|
||||
$path = [Environment]::GetFolderPath('MyPictures')
|
||||
}
|
||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Pictures folder at 📂$Path doesn't exist (yet)" }
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
if (-not(Test-Path "$path" -pathType container)) { throw "Pictures folder at 📂$path doesn't exist (yet)" }
|
||||
Set-Location "$path"
|
||||
"📂$path"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -62,4 +62,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-pics.ps1 as of 08/15/2024 09:50:44)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-pics.ps1 as of 11/08/2024 12:34:45)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script changes the working directory to the Public folder.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./cd-public.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/cd-public.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -48,13 +48,13 @@ Script Content
|
||||
|
||||
try {
|
||||
if ($IsLinux) {
|
||||
$Path = Resolve-Path "~/Public"
|
||||
$path = Resolve-Path "~/Public"
|
||||
} else {
|
||||
$Path = Resolve-Path "~/../Public"
|
||||
$path = Resolve-Path "~/../Public"
|
||||
}
|
||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Public folder at 📂$Path doesn't exist (yet)" }
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
if (-not(Test-Path "$path" -pathType container)) { throw "Public folder at 📂$path doesn't exist (yet)" }
|
||||
Set-Location "$path"
|
||||
"📂$path"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -62,4 +62,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-public.ps1 as of 08/15/2024 09:50:44)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-public.ps1 as of 11/08/2024 12:34:45)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script changes the working directory to the 'recent' folder.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./cd-recent.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/cd-recent.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -60,4 +60,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-recent.ps1 as of 08/15/2024 09:50:44)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-recent.ps1 as of 11/08/2024 12:34:45)*
|
||||
|
@ -39,7 +39,7 @@ function GetCurrentUserSID { [CmdletBinding()] param()
|
||||
|
||||
try {
|
||||
if ($IsLinux) {
|
||||
$path = "$HOME/.local/share/Trash/"
|
||||
$path = "~/.local/share/Trash/"
|
||||
} else {
|
||||
$path = "C:\`$Recycle.Bin\$(GetCurrentUserSID)"
|
||||
}
|
||||
@ -53,4 +53,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-recycle-bin.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-recycle-bin.ps1 as of 11/08/2024 12:34:45)*
|
||||
|
@ -1,15 +1,15 @@
|
||||
Script: *cd-repo.ps1*
|
||||
========================
|
||||
|
||||
This PowerShell script changes the working directory to a local Git repository.
|
||||
This PowerShell script changes the working directory to the given local Git repository.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./cd-repo.ps1 [[-folderName] <String>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/cd-repo.ps1 [[-folderName] <String>] [<CommonParameters>]
|
||||
|
||||
-folderName <String>
|
||||
Specifies the Git repository's folder name
|
||||
Specifies the folder name of the Git repository
|
||||
|
||||
Required? false
|
||||
Position? 1
|
||||
@ -26,7 +26,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./cd-repo.ps1 rust
|
||||
📂C:\Repos\rust - current branch is: ## main ... origin/main
|
||||
📂C:\Repos\rust · on branch: ## main ... origin/main
|
||||
|
||||
```
|
||||
|
||||
@ -43,14 +43,14 @@ Script Content
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Sets the working directory to a repository
|
||||
Sets the working directory to a repo
|
||||
.DESCRIPTION
|
||||
This PowerShell script changes the working directory to a local Git repository.
|
||||
This PowerShell script changes the working directory to the given local Git repository.
|
||||
.PARAMETER folderName
|
||||
Specifies the Git repository's folder name
|
||||
Specifies the folder name of the Git repository
|
||||
.EXAMPLE
|
||||
PS> ./cd-repo.ps1 rust
|
||||
📂C:\Repos\rust - current branch is: ## main ... origin/main
|
||||
📂C:\Repos\rust · on branch: ## main ... origin/main
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -62,25 +62,26 @@ param([string]$folderName = "")
|
||||
try {
|
||||
if ("$folderName" -eq "") { $folderName = Read-Host "Enter the Git repository's folder name" }
|
||||
|
||||
if (Test-Path "$HOME/Repos/" -pathType Container) { # try short name
|
||||
$path = "$HOME/Repos/"
|
||||
} 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) {
|
||||
if (Test-Path "~/Repos/" -pathType container) { # try short name
|
||||
$path = "~/Repos/"
|
||||
} elseif (Test-Path "~/repos/" -pathType container) {
|
||||
$path = "~/repos/"
|
||||
} elseif (Test-Path "~/Repositories/" -pathType container) { # try long name
|
||||
$path = "~/Repositories/"
|
||||
} elseif (Test-Path "~/source/repos/" -pathType container) { # try Visual Studio default
|
||||
$path = "~/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 += $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 - current branch is: " -noNewline
|
||||
Write-Host "📂$path · on branch: " -noNewline
|
||||
& git status --short --branch --show-stash
|
||||
exit 0 # success
|
||||
} catch {
|
||||
@ -89,4 +90,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-repo.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-repo.ps1 as of 11/08/2024 12:34:45)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script changes the working directory to the user's Git repositor
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./cd-repos.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/cd-repos.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -49,14 +49,14 @@ Script Content
|
||||
#>
|
||||
|
||||
try {
|
||||
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/"
|
||||
if (Test-Path "~/Repos/" -pathType Container) { # try short name
|
||||
$path = "~/Repos/"
|
||||
} elseif (Test-Path "~/repos/" -pathType Container) {
|
||||
$path = "~/repos/"
|
||||
} elseif (Test-Path "~/Repositories/" -pathType Container) { # try long name
|
||||
$path = "~/Repositories/"
|
||||
} elseif (Test-Path "~/source/repos/" -pathType Container) { # try Visual Studio default
|
||||
$path = "~/source/repos/"
|
||||
} elseif (Test-Path "/Repos/" -pathType Container) {
|
||||
$path = "/Repos/"
|
||||
} else {
|
||||
@ -73,4 +73,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-repos.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-repos.ps1 as of 11/08/2024 12:34:45)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script changes the current working directory to the root directo
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./cd-root.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/cd-root.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -47,9 +47,9 @@ Script Content
|
||||
#>
|
||||
|
||||
try {
|
||||
if ($IsLinux) { $Path = "/" } else { $Path = "C:\" }
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
if ($IsLinux) { $path = "/" } else { $path = "C:\" }
|
||||
Set-Location "$path"
|
||||
"📂$path"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -57,4 +57,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-root.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-root.ps1 as of 11/08/2024 12:34:45)*
|
||||
|
@ -33,21 +33,21 @@ Script Content
|
||||
|
||||
function GetScreenshotsFolder {
|
||||
if ($IsLinux) {
|
||||
$Path = "$HOME/Pictures"
|
||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Pictures folder at $Path doesn't exist (yet)" }
|
||||
if (Test-Path "$Path/Screenshots" -pathType container) { $Path = "$Path/Screenshots" }
|
||||
$path = "~/Pictures"
|
||||
if (-not(Test-Path "$path" -pathType container)) { throw "Pictures folder at $path doesn't exist (yet)" }
|
||||
if (Test-Path "$path/Screenshots" -pathType container) { $path = "$path/Screenshots" }
|
||||
} else {
|
||||
$Path = [Environment]::GetFolderPath('MyPictures')
|
||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Pictures folder at $Path doesn't exist (yet)" }
|
||||
if (Test-Path "$Path\Screenshots" -pathType container) { $Path = "$Path\Screenshots" }
|
||||
$path = [Environment]::GetFolderPath('MyPictures')
|
||||
if (-not(Test-Path "$path" -pathType container)) { throw "Pictures folder at $path doesn't exist (yet)" }
|
||||
if (Test-Path "$path\Screenshots" -pathType container) { $path = "$path\Screenshots" }
|
||||
}
|
||||
return $Path
|
||||
return $path
|
||||
}
|
||||
|
||||
try {
|
||||
$Path = GetScreenshotsFolder
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
$path = GetScreenshotsFolder
|
||||
Set-Location "$path"
|
||||
"📂$path"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -55,4 +55,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-screenshots.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-screenshots.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script changes the working directory to the PowerShell scripts f
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./cd-scripts.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/cd-scripts.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -58,4 +58,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-scripts.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-scripts.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -1,12 +1,12 @@
|
||||
Script: *cd-ssh.ps1*
|
||||
========================
|
||||
|
||||
This PowerShell script changes the working directory to the user's SSH folder.
|
||||
This PowerShell script changes the working directory to the user's secure shell (SSH) folder.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./cd-ssh.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/cd-ssh.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -16,7 +16,7 @@ PS> ./cd-ssh.ps1 [<CommonParameters>]
|
||||
Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./cd-ssh
|
||||
PS> ./cd-ssh.ps1
|
||||
📂C:\Users\Markus\.ssh
|
||||
|
||||
```
|
||||
@ -34,11 +34,11 @@ Script Content
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Sets the working directory to the user's SSH folder
|
||||
Sets the working directory to the SSH folder
|
||||
.DESCRIPTION
|
||||
This PowerShell script changes the working directory to the user's SSH folder.
|
||||
This PowerShell script changes the working directory to the user's secure shell (SSH) folder.
|
||||
.EXAMPLE
|
||||
PS> ./cd-ssh
|
||||
PS> ./cd-ssh.ps1
|
||||
📂C:\Users\Markus\.ssh
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
@ -47,15 +47,16 @@ Script Content
|
||||
#>
|
||||
|
||||
try {
|
||||
$Path = Resolve-Path "~/.ssh"
|
||||
if (-not(Test-Path "$Path" -pathType container)) { throw "User's SSH folder at 📂$Path doesn't exist (yet)" }
|
||||
Set-Location "$Path"
|
||||
$path = "~/.ssh"
|
||||
if (-not(Test-Path "$path" -pathType container)) { throw "Your secure shell (SSH) folder at 📂$path doesn't exist (yet)" }
|
||||
$path = Resolve-Path "$path"
|
||||
Set-Location "$path"
|
||||
"📂$Path"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
"⚠️ Error: $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-ssh.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-ssh.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -39,10 +39,10 @@ function GetTempDir {
|
||||
}
|
||||
|
||||
try {
|
||||
$Path = GetTempDir
|
||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Temporary folder at 📂$Path doesn't exist (yet)" }
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
$path = GetTempDir
|
||||
if (-not(Test-Path "$path" -pathType container)) { throw "Temporary folder at 📂$path doesn't exist (yet)" }
|
||||
Set-Location "$path"
|
||||
"📂$path"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -50,4 +50,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-temp.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-temp.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script changes the working directory to the templates folder.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./cd-templates.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/cd-templates.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -48,13 +48,13 @@ Script Content
|
||||
|
||||
try {
|
||||
if ($IsLinux) {
|
||||
$Path = Resolve-Path "~/Templates"
|
||||
$path = Resolve-Path "~/Templates"
|
||||
} else {
|
||||
$Path = [Environment]::GetFolderPath('Templates')
|
||||
$path = [Environment]::GetFolderPath('Templates')
|
||||
}
|
||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Templates folder at 📂$Path doesn't exist (yet)" }
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
if (-not(Test-Path "$path" -pathType container)) { throw "Templates folder at 📂$path doesn't exist (yet)" }
|
||||
Set-Location "$path"
|
||||
"📂$path"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -62,4 +62,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-templates.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-templates.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -39,7 +39,7 @@ function GetCurrentUserSID { [CmdletBinding()] param()
|
||||
|
||||
try {
|
||||
if ($IsLinux) {
|
||||
$path = "$HOME/.local/share/Trash/"
|
||||
$path = "~/.local/share/Trash/"
|
||||
} else {
|
||||
$path = "C:\`$Recycle.Bin\$(GetCurrentUserSID)"
|
||||
}
|
||||
@ -53,4 +53,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-trash.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-trash.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script changes the working directory to one directory level up.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./cd-up.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/cd-up.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -47,10 +47,10 @@ Script Content
|
||||
#>
|
||||
|
||||
try {
|
||||
$Path = Resolve-Path ".."
|
||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Folder at 📂$Path doesn't exist (yet)" }
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
$path = Resolve-Path ".."
|
||||
if (-not(Test-Path "$path" -pathType container)) { throw "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-up.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script changes the working directory to two directory level up.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./cd-up2.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/cd-up2.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -47,10 +47,10 @@ Script Content
|
||||
#>
|
||||
|
||||
try {
|
||||
$Path = Resolve-Path "../.."
|
||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Folder at 📂$Path doesn't exist (yet)" }
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
$path = Resolve-Path "../.."
|
||||
if (-not(Test-Path "$path" -pathType container)) { throw "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-up2.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up2.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script changes the working directory to three directory levels u
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./cd-up3.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/cd-up3.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -47,10 +47,10 @@ Script Content
|
||||
#>
|
||||
|
||||
try {
|
||||
$Path = Resolve-Path "../../.."
|
||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Folder at 📂$Path doesn't exist (yet)" }
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
$path = Resolve-Path "../../.."
|
||||
if (-not(Test-Path "$path" -pathType container)) { throw "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-up3.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up3.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script changes the working directory to four directory levels up
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./cd-up4.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/cd-up4.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -47,10 +47,10 @@ Script Content
|
||||
#>
|
||||
|
||||
try {
|
||||
$Path = Resolve-Path "../../../.."
|
||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Folder at 📂$Path doesn't exist (yet)" }
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
$path = Resolve-Path "../../../.."
|
||||
if (-not(Test-Path "$path" -pathType container)) { throw "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-up4.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up4.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script changes the working directory to the users directory.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./cd-users.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/cd-users.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -47,10 +47,10 @@ Script Content
|
||||
#>
|
||||
|
||||
try {
|
||||
$Path = Resolve-Path "$HOME/.."
|
||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Users directory at 📂$Path doesn't exist (yet)" }
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
$path = Resolve-Path "~/.."
|
||||
if (-not(Test-Path "$path" -pathType container)) { throw "Users directory 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-users.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-users.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script changes the working directory to the user's videos folder
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./cd-videos.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/cd-videos.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -48,13 +48,13 @@ Script Content
|
||||
|
||||
try {
|
||||
if ($IsLinux) {
|
||||
$Path = Resolve-Path "$HOME/Videos"
|
||||
$path = Resolve-Path "~/Videos"
|
||||
} else {
|
||||
$Path = [Environment]::GetFolderPath('MyVideos')
|
||||
$path = [Environment]::GetFolderPath('MyVideos')
|
||||
}
|
||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Videos folder at 📂$Path doesn't exist (yet)" }
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
if (-not(Test-Path "$path" -pathType container)) { throw "Videos folder at 📂$path doesn't exist (yet)" }
|
||||
Set-Location "$path"
|
||||
"📂$path"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -62,4 +62,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-videos.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-videos.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script changes the working directory to the Windows directory.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./cd-windows.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/cd-windows.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -47,10 +47,10 @@ Script Content
|
||||
#>
|
||||
|
||||
try {
|
||||
$Path = Resolve-Path "$env:WINDIR"
|
||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Windows directory at 📂$Path doesn't exist" }
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
$path = Resolve-Path "$env:WINDIR"
|
||||
if (-not(Test-Path "$path" -pathType container)) { throw "Windows directory at 📂$path doesn't exist" }
|
||||
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-windows.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-windows.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script downloads a random photo from Unsplash and sets it as des
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./change-wallpaper.ps1 [[-Category] <String>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/change-wallpaper.ps1 [[-Category] <String>] [<CommonParameters>]
|
||||
|
||||
-Category <String>
|
||||
Specifies the photo category (beach, city, ...)
|
||||
@ -79,4 +79,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of change-wallpaper.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of change-wallpaper.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script checks if the user has administrator rights.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-admin.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-admin.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -67,4 +67,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-admin.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-admin.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -24,50 +24,47 @@ Script Content
|
||||
This PowerShell script queries the installed applications and prints it.
|
||||
.EXAMPLE
|
||||
PS> ./check-apps.ps1
|
||||
✅ 119 Windows apps installed, 11 upgrades available
|
||||
⚠️ 150 Win apps installed, 72 upgrades available, 5 crash dump(s) found
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
function GetCrashDumps {
|
||||
function CountCrashDumps {
|
||||
[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
|
||||
return $files.Count
|
||||
}
|
||||
|
||||
try {
|
||||
$statusIcon = "✅"
|
||||
$statusMsg = ""
|
||||
$status = "✅"
|
||||
if ($IsLinux) {
|
||||
Write-Progress "Querying installed applications..."
|
||||
$numPkgs = (apt list --installed 2>/dev/null).Count
|
||||
$numSnaps = (snap list).Count - 1
|
||||
Write-Progress -completed "Done."
|
||||
$statusMsg += "$numPkgs Debian packages, $numSnaps snaps installed"
|
||||
$reply = "$numPkgs Debian packages, $numSnaps snaps installed"
|
||||
} else {
|
||||
Write-Progress "Querying installed apps..."
|
||||
$Apps = Get-AppxPackage
|
||||
$apps = Get-AppxPackage
|
||||
Write-Progress -completed "Done."
|
||||
$statusMsg = "$($Apps.Count) Win apps installed"
|
||||
$reply = "$($apps.Count) Win apps installed"
|
||||
|
||||
[int]$numNonOk = 0
|
||||
foreach($App in $Apps) { if ($App.Status -ne "Ok") { $numNonOk++ } }
|
||||
if ($numNonOk -gt 0) { $statusIcon = "⚠️"; $statusMsg += ", $numNonOk non-ok" }
|
||||
foreach($app in $apps) { if ($app.Status -ne "Ok") { $numNonOk++ } }
|
||||
if ($numNonOk -gt 0) { $status = "⚠️"; $reply += ", $numNonOk non-ok" }
|
||||
|
||||
[int]$numErrors = (Get-AppxLastError)
|
||||
if ($numErrors -gt 0) { $statusIcon = "⚠️"; $statusMsg += ", $numErrors errors" }
|
||||
if ($numErrors -gt 0) { $status = "⚠️"; $reply += ", $numErrors errors" }
|
||||
|
||||
$numUpdates = (winget upgrade --include-unknown).Count - 5
|
||||
$statusMsg += ", $numUpdates upgrades available"
|
||||
$reply += ", $numUpdates upgrades available"
|
||||
|
||||
$crashDumps = GetCrashDumps
|
||||
if ($crashDumps -ne 0) { $statusIcon = "⚠️"; $statusMsg += " - found $crashDumps crash dump(s)" }
|
||||
$numCrashDumps = CountCrashDumps
|
||||
if ($numCrashDumps -ne 0) { $status = "⚠️"; $reply += ", $numCrashDumps crash dump(s) found" }
|
||||
}
|
||||
Write-Host "$statusIcon $statusMsg"
|
||||
Write-Host "$status $reply"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -75,4 +72,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-apps.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-apps.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script queries the BIOS status and prints it.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-bios.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-bios.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -17,7 +17,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./check-bios.ps1
|
||||
✅ BIOS model P62 v02.67 by HP (version HPQOEM - 5, S/N CZC1080B01)
|
||||
✅ BIOS model P62 v02.67, version HPQOEM - 5, S/N CZC1080B01 by HP
|
||||
|
||||
```
|
||||
|
||||
@ -39,7 +39,7 @@ Script Content
|
||||
This PowerShell script queries the BIOS status and prints it.
|
||||
.EXAMPLE
|
||||
PS> ./check-bios.ps1
|
||||
✅ BIOS model P62 v02.67 by HP (version HPQOEM - 5, S/N CZC1080B01)
|
||||
✅ BIOS model P62 v02.67, version HPQOEM - 5, S/N CZC1080B01 by HP
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -48,27 +48,26 @@ Script Content
|
||||
|
||||
try {
|
||||
if ($IsLinux) {
|
||||
Write-Progress "Querying BIOS details..."
|
||||
$model = (sudo dmidecode -s system-product-name)
|
||||
if ("$model" -ne "") {
|
||||
$version = (sudo dmidecode -s bios-version)
|
||||
$releaseDate = (sudo dmidecode -s bios-release-date)
|
||||
$manufacturer = (sudo dmidecode -s system-manufacturer)
|
||||
Write-Host "✅ BIOS model $model by $manufacturer (version $version of $releaseDate)"
|
||||
}
|
||||
Write-Progress -completed "."
|
||||
if ("$model" -eq "") { exit 0 } # no information
|
||||
Write-Progress "Querying BIOS details..."
|
||||
$version = (sudo dmidecode -s bios-version)
|
||||
$releaseDate = (sudo dmidecode -s bios-release-date)
|
||||
$manufacturer = (sudo dmidecode -s system-manufacturer)
|
||||
Write-Progress -completed "Done."
|
||||
} else {
|
||||
$BIOS = Get-CimInstance -ClassName Win32_BIOS
|
||||
$model = $BIOS.Name.Trim()
|
||||
$version = $BIOS.Version.Trim()
|
||||
$serialNumber = $BIOS.SerialNumber.Trim()
|
||||
$manufacturer = $BIOS.Manufacturer.Trim()
|
||||
if ($serialNumber -eq "To be filled by O.E.M.") {
|
||||
Write-Host "✅ BIOS model $model by $manufacturer (version $version)"
|
||||
} else {
|
||||
Write-Host "✅ BIOS model $model by $manufacturer (version $version, S/N $serialNumber)"
|
||||
}
|
||||
$details = Get-CimInstance -ClassName Win32_BIOS
|
||||
$model = $details.Name.Trim()
|
||||
$version = $details.Version.Trim()
|
||||
$serial = $details.SerialNumber.Trim()
|
||||
$manufacturer = $details.Manufacturer.Trim()
|
||||
}
|
||||
if ($model -eq "To be filled by O.E.M.") { $model = "N/A" }
|
||||
if ($version -eq "To be filled by O.E.M.") { $version = "N/A" }
|
||||
if ("$releaseDate" -ne "") { $releaseDate = " of $releaseDate" }
|
||||
if ("$serial" -eq "") { $serial = "N/A" }
|
||||
if ($serial -eq "To be filled by O.E.M.") { $serial = "N/A" }
|
||||
Write-Host "✅ BIOS model $model, version $($version)$($releaseDate), S/N $serial by $manufacturer"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -76,4 +75,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-bios.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-bios.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -74,26 +74,31 @@ try {
|
||||
$details = Get-WmiObject -Class Win32_Processor
|
||||
$cpuName = $details.Name.trim()
|
||||
$arch = "$arch, "
|
||||
$deviceID = "$($details.DeviceID), "
|
||||
$speed = "$($details.MaxClockSpeed)MHz, "
|
||||
$socket = "$($details.SocketDesignation) socket"
|
||||
$deviceID = ", $($details.DeviceID)"
|
||||
$speed = ", $($details.MaxClockSpeed)MHz"
|
||||
$socket = ", $($details.SocketDesignation) socket"
|
||||
}
|
||||
$cores = [System.Environment]::ProcessorCount
|
||||
$celsius = GetCPUTemperature
|
||||
if ($celsius -eq 99999.9) {
|
||||
$temp = "no temp"
|
||||
$temp = ""
|
||||
} elseif ($celsius -gt 80) {
|
||||
$temp = ", $($celsius)°C TOO HOT"
|
||||
$status = "⚠️"
|
||||
} elseif ($celsius -gt 50) {
|
||||
$temp = "$($celsius)°C HOT"
|
||||
$temp = ", $($celsius)°C HOT"
|
||||
$status = "⚠️"
|
||||
} elseif ($celsius -lt 0) {
|
||||
$temp = "$($celsius)°C COLD"
|
||||
$temp = ", $($celsius)°C TOO COLD"
|
||||
$status = "⚠️"
|
||||
} elseif ($celsius -lt 30) {
|
||||
$temp = ", $($celsius)°C cool"
|
||||
} else {
|
||||
$temp = "$($celsius)°C OK"
|
||||
$temp = ", $($celsius)°C"
|
||||
}
|
||||
|
||||
Write-Progress -completed "Done."
|
||||
Write-Host "$status $cpuName ($($arch)$cores cores, $($deviceID)$($speed)$($socket)) - $temp"
|
||||
Write-Host "$status $cpuName ($($arch)$cores cores$($temp)$($deviceID)$($speed)$($socket))"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -101,4 +106,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-cpu.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-cpu.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script asks for credentials and checks them against saved ones (
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-credentials.ps1 [[-TargetFile] <String>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-credentials.ps1 [[-TargetFile] <String>] [<CommonParameters>]
|
||||
|
||||
-TargetFile <String>
|
||||
Specifies the target file ("$HOME\my.credentials" by default)
|
||||
@ -27,7 +27,7 @@ Example
|
||||
```powershell
|
||||
PS> ./check-credentials.ps1
|
||||
Enter username and password, please.
|
||||
✔️ Your credentials are correct.
|
||||
✅ Your credentials are correct.
|
||||
|
||||
```
|
||||
|
||||
@ -52,7 +52,7 @@ Script Content
|
||||
.EXAMPLE
|
||||
PS> ./check-credentials.ps1
|
||||
Enter username and password, please.
|
||||
✔️ Your credentials are correct.
|
||||
✅ Your credentials are correct.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -74,7 +74,7 @@ try {
|
||||
$pw2 = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($credsFromFile.Password))
|
||||
if ($pw1 -cne $pw2) { throw "Sorry, your password is wrong." }
|
||||
|
||||
"✔️ Your credentials are correct."
|
||||
"✅ Your credentials are correct."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -82,4 +82,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-credentials.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-credentials.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script determines and speaks the current day by text-to-speech (
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-day.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-day.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -17,7 +17,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./check-day
|
||||
✔️ It's Sunday.
|
||||
✅ It's Sunday.
|
||||
|
||||
```
|
||||
|
||||
@ -39,7 +39,7 @@ Script Content
|
||||
This PowerShell script determines and speaks the current day by text-to-speech (TTS).
|
||||
.EXAMPLE
|
||||
PS> ./check-day
|
||||
✔️ It's Sunday.
|
||||
✅ It's Sunday.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -57,4 +57,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-day.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-day.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -1,12 +1,12 @@
|
||||
Script: *check-dns.ps1*
|
||||
========================
|
||||
|
||||
This PowerShell script measures the DNS resolution speed (using 100 popular domains) and prints it.
|
||||
This PowerShell script measures the DNS resolution speed using 100 internet domains and prints it.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-dns.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-dns.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -17,7 +17,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./check-dns.ps1
|
||||
✅ DNS resolves 56.5 domains per second
|
||||
✅ Internet DNS lookups in 33.6ms
|
||||
|
||||
```
|
||||
|
||||
@ -36,10 +36,10 @@ Script Content
|
||||
.SYNOPSIS
|
||||
Check the DNS resolution
|
||||
.DESCRIPTION
|
||||
This PowerShell script measures the DNS resolution speed (using 100 popular domains) and prints it.
|
||||
This PowerShell script measures the DNS resolution speed using 100 internet domains and prints it.
|
||||
.EXAMPLE
|
||||
PS> ./check-dns.ps1
|
||||
✅ DNS resolves 56.5 domains per second
|
||||
✅ Internet DNS lookups in 33.6ms
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -47,24 +47,21 @@ Script Content
|
||||
#>
|
||||
|
||||
try {
|
||||
#Write-Progress "Measuring DNS resolution..."
|
||||
$table = Import-CSV "$PSScriptRoot/../data/popular-domains.csv"
|
||||
$numRows = $table.Length
|
||||
|
||||
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
if ($IsLinux) {
|
||||
foreach($row in $table){$nop=dig $row.Domain +short}
|
||||
} else {
|
||||
Clear-DnsClientCache
|
||||
foreach($row in $table){$nop=Resolve-DNSName $row.Domain}
|
||||
}
|
||||
[float]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||
|
||||
#Write-Progress -completed "Measuring DNS resolution..."
|
||||
$average = [math]::round($numRows / $elapsed, 1)
|
||||
if ($average -lt 10.0) {
|
||||
Write-Host "⚠️ DNS resolves $average domains per second only"
|
||||
[float]$elapsed = $stopWatch.Elapsed.TotalSeconds * 1000.0
|
||||
$speed = [math]::round($elapsed / $table.Length, 1)
|
||||
if ($speed -gt 100.0) {
|
||||
Write-Host "⚠️ Internet DNS lookups take $($speed)ms!"
|
||||
} else {
|
||||
Write-Host "✅ DNS resolves $average domains per second"
|
||||
Write-Host "✅ Internet DNS lookups in $($speed)ms"
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
@ -73,4 +70,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-dns.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-dns.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script checks the given drive for free space left (10 GB by defa
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-drive-space.ps1 [[-driveName] <String>] [[-minLevel] <Int64>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-drive-space.ps1 [[-driveName] <String>] [[-minLevel] <Int64>] [<CommonParameters>]
|
||||
|
||||
-driveName <String>
|
||||
Specifies the drive name to check (e.g. "C")
|
||||
@ -110,4 +110,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-drive-space.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-drive-space.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -6,14 +6,14 @@ This PowerShell script queries the free space of all drives and prints it.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-drives.ps1 [[-minLevel] <Int64>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-drives.ps1 [[-minLevel] <Int64>] [<CommonParameters>]
|
||||
|
||||
-minLevel <Int64>
|
||||
Specifies the minimum warning level (10GB by default)
|
||||
Specifies the minimum warning level (5GB by default)
|
||||
|
||||
Required? false
|
||||
Position? 1
|
||||
Default value 10
|
||||
Default value 5368709120
|
||||
Accept pipeline input? false
|
||||
Accept wildcard characters? false
|
||||
|
||||
@ -26,8 +26,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./check-drives.ps1
|
||||
✅ Drive C: uses 49% of 1TB - 512GB free
|
||||
✅ Drive D: uses 84% of 4TB - 641GB free
|
||||
✅ Drive C: uses 489GB (53%) of 930GB, D: uses 3TB (87%) of 4TB, E: is empty
|
||||
|
||||
```
|
||||
|
||||
@ -48,51 +47,54 @@ Script Content
|
||||
.DESCRIPTION
|
||||
This PowerShell script queries the free space of all drives and prints it.
|
||||
.PARAMETER minLevel
|
||||
Specifies the minimum warning level (10GB by default)
|
||||
Specifies the minimum warning level (5GB by default)
|
||||
.EXAMPLE
|
||||
PS> ./check-drives.ps1
|
||||
✅ Drive C: uses 49% of 1TB - 512GB free
|
||||
✅ Drive D: uses 84% of 4TB - 641GB free
|
||||
✅ Drive C: uses 489GB (53%) of 930GB, D: uses 3TB (87%) of 4TB, E: is empty
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
param([int64]$minLevel = 10) # 10 GB minimum
|
||||
param([int64]$minLevel = 5GB)
|
||||
|
||||
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)
|
||||
function Bytes2String { param([int64]$bytes)
|
||||
if ($bytes -lt 1KB) { return "$bytes bytes" }
|
||||
if ($bytes -lt 1MB) { return '{0:N0}KB' -f ($bytes / 1KB) }
|
||||
if ($bytes -lt 1GB) { return '{0:N0}MB' -f ($bytes / 1MB) }
|
||||
if ($bytes -lt 1TB) { return '{0:N0}GB' -f ($bytes / 1GB) }
|
||||
if ($bytes -lt 1PB) { return '{0:N0}TB' -f ($bytes / 1TB) }
|
||||
return '{0:N0}GB' -f ($bytes / 1PB)
|
||||
}
|
||||
|
||||
try {
|
||||
Write-Progress "Querying drives..."
|
||||
$drives = Get-PSDrive -PSProvider FileSystem
|
||||
$minLevel *= 1GB
|
||||
Write-Progress -completed " "
|
||||
Write-Progress -completed "Done."
|
||||
$status = "✅"
|
||||
$reply = "Drive "
|
||||
foreach($drive in $drives) {
|
||||
$details = (Get-PSDrive $drive.Name)
|
||||
if ($IsLinux) { $name = $drive.Name } else { $name = $drive.Name + ":" }
|
||||
[int64]$free = $details.Free
|
||||
[int64]$used = $details.Used
|
||||
[int64]$total = ($used + $free)
|
||||
|
||||
if ($reply -ne "Drive ") { $reply += ", " }
|
||||
if ($total -eq 0) {
|
||||
Write-Host "✅ Drive $name is empty"
|
||||
$reply += "$name is empty"
|
||||
} elseif ($free -eq 0) {
|
||||
Write-Host "⚠️ Drive $name with $(Bytes2String $total) is full"
|
||||
$status = "⚠️"
|
||||
$reply += "$name with ($(Bytes2String $total)) is FULL"
|
||||
} elseif ($free -lt $minLevel) {
|
||||
Write-Host "⚠️ Drive $name with $(Bytes2String $total) is nearly full, $(Bytes2String $free) free"
|
||||
$status = "⚠️"
|
||||
$reply += "$name nearly full ($(Bytes2String $free) of $(Bytes2String $total) left)"
|
||||
} else {
|
||||
[int64]$percent = ($used * 100) / $total
|
||||
Write-Host "✅ Drive $name uses $percent% of $(Bytes2String $total) - $(Bytes2String $free) free"
|
||||
$reply += "$name uses $(Bytes2String $used) ($percent%) of $(Bytes2String $total)"
|
||||
}
|
||||
}
|
||||
Write-Host "$status $reply"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -100,4 +102,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-drives.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-drives.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -63,4 +63,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-dusk.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-dusk.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script checks the time until Easter Sunday and replies by text-t
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-easter-sunday.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-easter-sunday.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -61,4 +61,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-easter-sunday.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-easter-sunday.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script checks the file system of a drive. It needs admin rights.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-file-system.ps1 [[-Drive] <String>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-file-system.ps1 [[-Drive] <String>] [<CommonParameters>]
|
||||
|
||||
-Drive <String>
|
||||
Specifies the drive to check
|
||||
@ -26,7 +26,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./check-file-system C
|
||||
✔️ file system on drive C is clean
|
||||
✅ file system on drive C is clean
|
||||
|
||||
```
|
||||
|
||||
@ -50,7 +50,7 @@ Script Content
|
||||
Specifies the drive to check
|
||||
.EXAMPLE
|
||||
PS> ./check-file-system C
|
||||
✔️ file system on drive C is clean
|
||||
✅ file system on drive C is clean
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -75,4 +75,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-file-system.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-file-system.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script determines and prints the file type of the given file.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-file.ps1 [[-Path] <String>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-file.ps1 [[-Path] <String>] [<CommonParameters>]
|
||||
|
||||
-Path <String>
|
||||
Specifies the path to the file
|
||||
@ -170,4 +170,4 @@ function Check-Header { param( $path )
|
||||
Check-Header $Path
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-file.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-file.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script queries the status of the firewall and prints it.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-firewall.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-firewall.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -65,4 +65,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-firewall.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-firewall.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -65,4 +65,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-gpu.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-gpu.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script queries the hardware details of the local computer and pr
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-hardware.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-hardware.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -56,6 +56,7 @@ Write-Host "`n H A R D W A R E" -foregroundColor green
|
||||
& "$PSScriptRoot/check-cpu.ps1"
|
||||
& "$PSScriptRoot/check-ram.ps1"
|
||||
& "$PSScriptRoot/check-gpu.ps1"
|
||||
& "$PSScriptRoot/check-motherboard.ps1"
|
||||
& "$PSScriptRoot/check-bios.ps1"
|
||||
& "$PSScriptRoot/check-smart-devices.ps1"
|
||||
& "$PSScriptRoot/check-power.ps1"
|
||||
@ -63,4 +64,4 @@ Write-Host "`n H A R D W A R E" -foregroundColor green
|
||||
exit 0 # success
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-hardware.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-hardware.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script queries the system health of the local computer (hardware
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-health.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-health.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -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 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-health.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script checks the time until Indepence Day and replies by text-t
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-independence-day.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-independence-day.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -61,4 +61,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-independence-day.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-independence-day.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script checks the given IPv4 address for validity.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-ipv4-address.ps1 [[-Address] <String>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-ipv4-address.ps1 [[-Address] <String>] [<CommonParameters>]
|
||||
|
||||
-Address <String>
|
||||
Specifies the IPv4 address to check
|
||||
@ -26,7 +26,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./check-ipv4-address 192.168.11.22
|
||||
✔️ IPv4 192.168.11.22 is valid
|
||||
✅ IPv4 192.168.11.22 is valid
|
||||
|
||||
```
|
||||
|
||||
@ -50,7 +50,7 @@ Script Content
|
||||
Specifies the IPv4 address to check
|
||||
.EXAMPLE
|
||||
PS> ./check-ipv4-address 192.168.11.22
|
||||
✔️ IPv4 192.168.11.22 is valid
|
||||
✅ IPv4 192.168.11.22 is valid
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -72,7 +72,7 @@ try {
|
||||
if ($Address -eq "" ) { $Address = read-host "Enter IPv4 address to validate" }
|
||||
|
||||
if (IsIPv4AddressValid $Address) {
|
||||
"✔️ IPv4 $Address is valid"
|
||||
"✅ IPv4 $Address is valid"
|
||||
exit 0 # success
|
||||
} else {
|
||||
write-warning "Invalid IPv4 address: $Address"
|
||||
@ -84,4 +84,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-ipv4-address.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-ipv4-address.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script checks the given IPv6 address for validity
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-ipv6-address.ps1 [[-Address] <String>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-ipv6-address.ps1 [[-Address] <String>] [<CommonParameters>]
|
||||
|
||||
-Address <String>
|
||||
Specifies the IPv6 address to check
|
||||
@ -26,7 +26,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./check-ipv6-address fe80::200:5aee:feaa:20a2
|
||||
✔️ IPv6 fe80::200:5aee:feaa:20a2 is valid
|
||||
✅ IPv6 fe80::200:5aee:feaa:20a2 is valid
|
||||
|
||||
```
|
||||
|
||||
@ -50,7 +50,7 @@ Script Content
|
||||
Specifies the IPv6 address to check
|
||||
.EXAMPLE
|
||||
PS> ./check-ipv6-address fe80::200:5aee:feaa:20a2
|
||||
✔️ IPv6 fe80::200:5aee:feaa:20a2 is valid
|
||||
✅ IPv6 fe80::200:5aee:feaa:20a2 is valid
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -86,7 +86,7 @@ try {
|
||||
$Address = read-host "Enter IPv6 address to validate"
|
||||
}
|
||||
if (IsIPv6AddressValid $Address) {
|
||||
"✔️ IPv6 $Address is valid"
|
||||
"✅ IPv6 $Address is valid"
|
||||
exit 0 # success
|
||||
} else {
|
||||
write-warning "Invalid IPv6 address: $Address"
|
||||
@ -98,4 +98,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-ipv6-address.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-ipv6-address.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script queries the position of the International Space Station (
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-iss-position.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-iss-position.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -55,4 +55,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-iss-position.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-iss-position.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -7,7 +7,7 @@ Supported MAC address formats are: 00:00:00:00:00:00 or 00-00-00-00-00-00 or 000
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-mac-address.ps1 [[-MAC] <String>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-mac-address.ps1 [[-MAC] <String>] [<CommonParameters>]
|
||||
|
||||
-MAC <String>
|
||||
Specifies the MAC address to check
|
||||
@ -27,7 +27,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./check-mac-address 11:22:33:44:55:66
|
||||
✔️ MAC address 11:22:33:44:55:66 is valid
|
||||
✅ MAC address 11:22:33:44:55:66 is valid
|
||||
|
||||
```
|
||||
|
||||
@ -52,7 +52,7 @@ Script Content
|
||||
Specifies the MAC address to check
|
||||
.EXAMPLE
|
||||
PS> ./check-mac-address 11:22:33:44:55:66
|
||||
✔️ MAC address 11:22:33:44:55:66 is valid
|
||||
✅ MAC address 11:22:33:44:55:66 is valid
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -75,7 +75,7 @@ try {
|
||||
$MAC = read-host "Enter MAC address to validate"
|
||||
}
|
||||
if (IsMACAddressValid $MAC) {
|
||||
"✔️ MAC address $MAC is valid"
|
||||
"✅ MAC address $MAC is valid"
|
||||
exit 0 # success
|
||||
} else {
|
||||
write-warning "Invalid MAC address: $MAC"
|
||||
@ -87,4 +87,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-mac-address.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-mac-address.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -60,4 +60,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-midnight.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-midnight.ps1 as of 11/08/2024 12:34:46)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script determines and speaks the current month name by text-to-s
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-month.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-month.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -17,7 +17,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./check-month
|
||||
✔️ It's December.
|
||||
✅ It's December.
|
||||
|
||||
```
|
||||
|
||||
@ -39,7 +39,7 @@ Script Content
|
||||
This PowerShell script determines and speaks the current month name by text-to-speech (TTS).
|
||||
.EXAMPLE
|
||||
PS> ./check-month
|
||||
✔️ It's December.
|
||||
✅ It's December.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -57,4 +57,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-month.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-month.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script determines the Moon phase and answers by text-to-speech (
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-moon-phase.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-moon-phase.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -76,4 +76,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-moon-phase.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-moon-phase.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
62
docs/check-motherboard.md
Normal file
62
docs/check-motherboard.md
Normal file
@ -0,0 +1,62 @@
|
||||
Script: *check-motherboard.ps1*
|
||||
========================
|
||||
|
||||
This PowerShell script lists the motherboard details.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
/home/markus/Repos/PowerShell/scripts/check-motherboard.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
|
||||
```
|
||||
|
||||
Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./check-motherboard.ps1
|
||||
✅ Motherboard Calla_LC by LN
|
||||
|
||||
```
|
||||
|
||||
Notes
|
||||
-----
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
|
||||
Related Links
|
||||
-------------
|
||||
https://github.com/fleschutz/PowerShell
|
||||
|
||||
Script Content
|
||||
--------------
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Lists motherboard details
|
||||
.DESCRIPTION
|
||||
This PowerShell script lists the motherboard details.
|
||||
.EXAMPLE
|
||||
PS> ./check-motherboard.ps1
|
||||
✅ Motherboard Calla_LC by LN
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
if ($IsLinux) {
|
||||
} else {
|
||||
$details = Get-WmiObject -Class Win32_BaseBoard
|
||||
"✅ Motherboard $($details.Product) by $($details.Manufacturer)"
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-motherboard.ps1 as of 11/08/2024 12:34:47)*
|
@ -6,7 +6,7 @@ This PowerShell script queries the network details of the local computer and pri
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-network.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-network.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -21,7 +21,7 @@ PS> ./check-network.ps1
|
||||
|
||||
|
||||
N E T W O R K
|
||||
✅ Online with 30ms latency (16ms..56ms, 0/10 loss)
|
||||
✅ Firewall enabled
|
||||
...
|
||||
|
||||
```
|
||||
@ -39,14 +39,14 @@ Script Content
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checks the network details
|
||||
Checks the network
|
||||
.DESCRIPTION
|
||||
This PowerShell script queries the network details of the local computer and prints it.
|
||||
.EXAMPLE
|
||||
PS> ./check-network.ps1
|
||||
|
||||
N E T W O R K
|
||||
✅ Online with 30ms latency (16ms..56ms, 0/10 loss)
|
||||
N E T W O R K
|
||||
✅ Firewall enabled
|
||||
...
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
@ -55,13 +55,16 @@ Script Content
|
||||
#>
|
||||
|
||||
Write-Host "`n N E T W O R K" -foregroundColor green
|
||||
& "$PSScriptRoot/list-ip-addresses.ps1"
|
||||
& "$PSScriptRoot/ping-remote-hosts.ps1"
|
||||
& "$PSScriptRoot/check-firewall"
|
||||
& "$PSScriptRoot/check-dns.ps1"
|
||||
& "$PSScriptRoot/list-local-ip.ps1"
|
||||
& "$PSScriptRoot/list-network-shares.ps1"
|
||||
& "$PSScriptRoot/ping-local-devices.ps1"
|
||||
& "$PSScriptRoot/check-vpn.ps1"
|
||||
& "$PSScriptRoot/ping-local-hosts.ps1"
|
||||
& "$PSScriptRoot/list-internet-ip.ps1"
|
||||
& "$PSScriptRoot/ping-internet.ps1"
|
||||
& "$PSScriptRoot/check-dns.ps1"
|
||||
& "$PSScriptRoot/list-ssh-key.ps1"
|
||||
exit 0 # success
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-network.ps1 as of 08/15/2024 09:50:45)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-network.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -59,4 +59,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-noon.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-noon.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script queries the operating system status and prints it.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-os.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-os.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -17,7 +17,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./check-os.ps1
|
||||
✅ Windows 10 Pro 64-bit (v10.0.19045, since 6/22/2021, S/N 00123-45678-15135-AAOEM, P/K AB123-CD456-EF789-GH000-WFR6P)
|
||||
✅ Windows 10 Pro 64-bit since 6/22/2021 (v10.0.19045, S/N 00123-45678-15135-AAOEM, P/K AB123-CD456-EF789-GH000-WFR6P)
|
||||
|
||||
```
|
||||
|
||||
@ -39,7 +39,7 @@ Script Content
|
||||
This PowerShell script queries the operating system status and prints it.
|
||||
.EXAMPLE
|
||||
PS> ./check-os.ps1
|
||||
✅ Windows 10 Pro 64-bit (v10.0.19045, since 6/22/2021, S/N 00123-45678-15135-AAOEM, P/K AB123-CD456-EF789-GH000-WFR6P)
|
||||
✅ Windows 10 Pro 64-bit since 6/22/2021 (v10.0.19045, S/N 00123-45678-15135-AAOEM, P/K AB123-CD456-EF789-GH000-WFR6P)
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -64,7 +64,7 @@ try {
|
||||
$InstallDate = $OSDetails.InstallDate
|
||||
|
||||
$ProductKey = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" -Name BackupProductKeyDefault).BackupProductKeyDefault
|
||||
Write-Host "✅ $Name $Arch (v$Version, since $($InstallDate.ToShortDateString()), S/N $Serial, P/K $ProductKey)"
|
||||
Write-Host "✅ $Name $Arch since $($InstallDate.ToShortDateString()) (v$Version, S/N $Serial, P/K $ProductKey)"
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
@ -73,4 +73,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-os.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-os.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script checks the inbox of Outlook for new/unread mails.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-outlook.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-outlook.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -65,4 +65,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-outlook.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-outlook.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script checks the security status of the given password by havei
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-password.ps1 [[-password] <String>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-password.ps1 [[-password] <String>] [<CommonParameters>]
|
||||
|
||||
-password <String>
|
||||
|
||||
@ -94,4 +94,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-password.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-password.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -41,50 +41,48 @@ function Test-RegistryValue { param([parameter(Mandatory=$true)][ValidateNotNull
|
||||
}
|
||||
|
||||
try {
|
||||
$Reason = ""
|
||||
$reply = "✅ No pending reboot"
|
||||
if ($IsLinux) {
|
||||
if (Test-Path "/var/run/reboot-required") {
|
||||
$Reason = "found: /var/run/reboot-required"
|
||||
Write-Host "⚠️ Pending reboot ($Reason)"
|
||||
$reply = "⚠️ Pending reboot (found: /var/run/reboot-required)"
|
||||
}
|
||||
} else {
|
||||
$reason = ""
|
||||
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired") {
|
||||
$Reason += ", ...\Auto Update\RebootRequired"
|
||||
$reason += ", ...\Auto Update\RebootRequired"
|
||||
}
|
||||
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\PostRebootReporting") {
|
||||
$Reason += ", ...\Auto Update\PostRebootReporting"
|
||||
$reason += ", ...\Auto Update\PostRebootReporting"
|
||||
}
|
||||
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending") {
|
||||
$Reason += ", ...\Component Based Servicing\RebootPending"
|
||||
$reason += ", ...\Component Based Servicing\RebootPending"
|
||||
}
|
||||
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\ServerManager\CurrentRebootAttempts") {
|
||||
$Reason += ", ...\ServerManager\CurrentRebootAttempts"
|
||||
$reason += ", ...\ServerManager\CurrentRebootAttempts"
|
||||
}
|
||||
if (Test-RegistryValue -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing" -Value "RebootInProgress") {
|
||||
$Reason += ", ...\CurrentVersion\Component Based Servicing with 'RebootInProgress'"
|
||||
$reason += ", ...\CurrentVersion\Component Based Servicing with 'RebootInProgress'"
|
||||
}
|
||||
if (Test-RegistryValue -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing" -Value "PackagesPending") {
|
||||
$Reason += ", '...\CurrentVersion\Component Based Servicing' with 'PackagesPending'"
|
||||
$reason += ", '...\CurrentVersion\Component Based Servicing' with 'PackagesPending'"
|
||||
}
|
||||
if (Test-RegistryValue -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" -Value "PendingFileRenameOperations2") {
|
||||
$Reason += ", '...\CurrentControlSet\Control\Session Manager' with 'PendingFileRenameOperations2'"
|
||||
$reason += ", '...\CurrentControlSet\Control\Session Manager' with 'PendingFileRenameOperations2'"
|
||||
}
|
||||
if (Test-RegistryValue -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" -Value "DVDRebootSignal") {
|
||||
$Reason += ", '...\Windows\CurrentVersion\RunOnce' with 'DVDRebootSignal'"
|
||||
$reason += ", '...\Windows\CurrentVersion\RunOnce' with 'DVDRebootSignal'"
|
||||
}
|
||||
if (Test-RegistryValue -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon" -Value "JoinDomain") {
|
||||
$Reason += ", '...\CurrentControlSet\Services\Netlogon' with 'JoinDomain'"
|
||||
$reason += ", '...\CurrentControlSet\Services\Netlogon' with 'JoinDomain'"
|
||||
}
|
||||
if (Test-RegistryValue -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon" -Value "AvoidSpnSet") {
|
||||
$Reason += ", '...\CurrentControlSet\Services\Netlogon' with 'AvoidSpnSet'"
|
||||
$reason += ", '...\CurrentControlSet\Services\Netlogon' with 'AvoidSpnSet'"
|
||||
}
|
||||
if ($Reason -ne "") {
|
||||
Write-Host "⚠️ Pending reboot (registry got $($Reason.substring(2)))"
|
||||
if ($reason -ne "") {
|
||||
$reply = "⚠️ Pending reboot (registry got $($reason.substring(2)))"
|
||||
}
|
||||
}
|
||||
if ($Reason -eq "") {
|
||||
Write-Host "✅ No pending reboot"
|
||||
}
|
||||
Write-Host $reply
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -92,4 +90,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-pending-reboot.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-pending-reboot.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script checks all Plug'n'PLay devices connected to the local com
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-pnp-devices.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-pnp-devices.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -65,4 +65,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-pnp-devices.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-pnp-devices.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script queries the power status and prints it.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-power.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-power.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -17,7 +17,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./check-power.ps1
|
||||
⚠️ Battery at 9% with 54min remaining · power scheme 'HP Optimized'
|
||||
⚠️ Battery 9% only with 54min remaining (power scheme is 'HP Optimized')
|
||||
|
||||
```
|
||||
|
||||
@ -39,7 +39,7 @@ Script Content
|
||||
This PowerShell script queries the power status and prints it.
|
||||
.EXAMPLE
|
||||
PS> ./check-power.ps1
|
||||
⚠️ Battery at 9% with 54min remaining · power scheme 'HP Optimized'
|
||||
⚠️ Battery 9% only with 54min remaining (power scheme is 'HP Optimized')
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -54,35 +54,34 @@ try {
|
||||
$details = [System.Windows.Forms.SystemInformation]::PowerStatus
|
||||
[int]$percent = 100 * $details.BatteryLifePercent
|
||||
[int]$remaining = $details.BatteryLifeRemaining / 60
|
||||
$powerScheme = (powercfg /getactivescheme)
|
||||
$powerScheme = $powerScheme -Replace "^(.*) \(",""
|
||||
$powerScheme = $powerScheme -Replace "\)$",""
|
||||
if ($details.PowerLineStatus -eq "Online") {
|
||||
if ($details.BatteryChargeStatus -eq "NoSystemBattery") {
|
||||
$reply = "✅ AC powered"
|
||||
} elseif ($percent -ge 95) {
|
||||
$reply = "✅ Battery $percent% full"
|
||||
$reply = "✅ Battery nearly full ($percent%, power scheme is '$powerScheme')"
|
||||
} else {
|
||||
$reply = "✅ Battery charging ($percent%)"
|
||||
$reply = "✅ Battery $percent% and charging (power scheme is '$powerScheme')"
|
||||
}
|
||||
} else { # must be offline
|
||||
if (($remaining -eq 0) -and ($percent -ge 60)) {
|
||||
$reply = "✅ Battery $percent% full"
|
||||
$reply = "✅ Battery $percent% full (power scheme is '$powerScheme')"
|
||||
} elseif ($remaining -eq 0) {
|
||||
$reply = "✅ Battery at $percent%"
|
||||
$reply = "✅ Battery at $percent% (power scheme is '$powerScheme')"
|
||||
} elseif ($remaining -le 5) {
|
||||
$reply = "⚠️ Battery at $percent% with ONLY $($remaining)min remaining"
|
||||
$reply = "⚠️ Battery $percent% ONLY $($remaining)min remaining (power scheme is '$powerScheme')"
|
||||
} elseif ($remaining -le 30) {
|
||||
$reply = "⚠️ Battery at $percent% with only $($remaining)min remaining"
|
||||
$reply = "⚠️ Battery $percent% only $($remaining)min remaining (power scheme is '$powerScheme')"
|
||||
} elseif ($percent -lt 10) {
|
||||
$reply = "⚠️ Battery at $percent% with $($remaining)min remaining"
|
||||
} elseif ($percent -ge 80) {
|
||||
$reply = "✅ Battery $percent% full with $($remaining)min remaining"
|
||||
$reply = "⚠️ Battery $percent% only with $($remaining)min remaining (power scheme is '$powerScheme') "
|
||||
} elseif ($percent -ge 90) {
|
||||
$reply = "✅ Battery $percent% full with $($remaining)min remaining (power scheme is '$powerScheme')"
|
||||
} else {
|
||||
$reply = "✅ Battery at $percent% with $($remaining)min remaining"
|
||||
$reply = "✅ Battery $percent% with $($remaining)min remaining (power scheme is '$powerScheme') "
|
||||
}
|
||||
}
|
||||
$powerScheme = (powercfg /getactivescheme)
|
||||
$powerScheme = $powerScheme -Replace "^(.*) \(",""
|
||||
$powerScheme = $powerScheme -Replace "\)$",""
|
||||
$reply += ", power scheme is '$powerScheme'"
|
||||
}
|
||||
Write-Host $reply
|
||||
exit 0 # success
|
||||
@ -92,4 +91,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-power.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-power.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -59,4 +59,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-powershell.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-powershell.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script checks the given PowerShell script file(s) for validity.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-ps1-file.ps1 [[-filePattern] <String>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-ps1-file.ps1 [[-filePattern] <String>] [<CommonParameters>]
|
||||
|
||||
-filePattern <String>
|
||||
Specifies the file pattern to the PowerShell file(s)
|
||||
@ -26,7 +26,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./check-ps1-file *.ps1
|
||||
✔️ Valid PowerShell in myfile.ps1
|
||||
✅ Valid PowerShell in myfile.ps1
|
||||
|
||||
```
|
||||
|
||||
@ -50,7 +50,7 @@ Script Content
|
||||
Specifies the file pattern to the PowerShell file(s)
|
||||
.EXAMPLE
|
||||
PS> ./check-ps1-file *.ps1
|
||||
✔️ Valid PowerShell in myfile.ps1
|
||||
✅ Valid PowerShell in myfile.ps1
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -67,7 +67,7 @@ try {
|
||||
$syntaxError = @()
|
||||
[void][System.Management.Automation.Language.Parser]::ParseFile($file, [ref]$null, [ref]$syntaxError)
|
||||
if ("$syntaxError" -ne "") { throw "$syntaxError" }
|
||||
"✔️ Valid PowerShell in $($file.Name)"
|
||||
"✅ Valid PowerShell in $($file.Name)"
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
@ -76,4 +76,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-ps1-file.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-ps1-file.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -98,4 +98,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-ram.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-ram.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script verifies the integrity of a local Git repository and perf
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-repo.ps1 [[-pathToRepo] <String>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-repo.ps1 [[-pathToRepo] <String>] [<CommonParameters>]
|
||||
|
||||
-pathToRepo <String>
|
||||
Specifies the file path to the local Git repository (current working directory by default)
|
||||
@ -121,7 +121,7 @@ try {
|
||||
|
||||
$repoDirName = (Get-Item "$FullPath").Name
|
||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||
"✔️ Checked 📂$repoDirName repo in $($elapsed)s."
|
||||
"✅ Checked 📂$repoDirName repo in $($elapsed)s."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -129,4 +129,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-repo.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-repo.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script verifies the data integrity of all Git repositories in a
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-repos.ps1 [[-parentDir] <String>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-repos.ps1 [[-parentDir] <String>] [<CommonParameters>]
|
||||
|
||||
-parentDir <String>
|
||||
Specifies the file path to the parent folder
|
||||
@ -29,7 +29,7 @@ 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.
|
||||
✅ Checked all 16 Git repos in 📂C:\Repos in 356s.
|
||||
|
||||
```
|
||||
|
||||
@ -56,7 +56,7 @@ Script Content
|
||||
⏳ Checking parent folder 📂C:\Repos... 16 subfolders
|
||||
⏳ Checking 📂rust repository (1/16)...
|
||||
...
|
||||
✔️ Checked all 16 Git repos in 📂C:\Repos in 356s.
|
||||
✅ Checked all 16 Git repos in 📂C:\Repos in 356s.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -83,7 +83,7 @@ try {
|
||||
}
|
||||
|
||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||
"✔️ Checked all $numFolders Git repos in 📂$parentDir in $($elapsed)s."
|
||||
"✅ Checked all $numFolders Git repos in 📂$parentDir in $($elapsed)s."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -91,4 +91,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-repos.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-repos.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script checks the time until Saint Nicholas Day and replies by t
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-santa.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-santa.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -56,4 +56,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-santa.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-santa.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -24,7 +24,7 @@ Script Content
|
||||
This PowerShell script queries the status of the SSD/HDD devices (supporting S.M.A.R.T.) and prints it.
|
||||
.EXAMPLE
|
||||
PS> ./check-smart-devices.ps1
|
||||
✅ 1TB Samsung SSD 970 EVO via NVMe (37°C, 2388 hours, 289x on/off, v2B2QEXE7) - selftest OK
|
||||
✅ 1TB Samsung SSD 970 EVO via NVMe (37°C, 2388 hours, 289x on/off, v2B2QEXE7, test passed)
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -82,7 +82,10 @@ try {
|
||||
$capacity = ""
|
||||
}
|
||||
if ($details.temperature.current -gt 50) {
|
||||
$temp = "$($details.temperature.current)°C (!)"
|
||||
$temp = "$($details.temperature.current)°C TOO HOT"
|
||||
$status = "⚠️"
|
||||
} elseif ($details.temperature.current -lt 0) {
|
||||
$temp = "$($details.temperature.current)°C TOO COLD"
|
||||
$status = "⚠️"
|
||||
} else {
|
||||
$temp = "$($details.temperature.current)°C"
|
||||
@ -100,13 +103,13 @@ try {
|
||||
$powerOn = "$($details.power_cycle_count)x on/off"
|
||||
}
|
||||
if ($details.smart_status.passed) {
|
||||
$selftest = "selftest OK"
|
||||
$selftest = "test passed"
|
||||
} else {
|
||||
$selftest = "selftest FAILED"
|
||||
$selftest = "test FAILED"
|
||||
$status = "⚠️"
|
||||
}
|
||||
$firmwareVersion = $details.firmware_version
|
||||
Write-Host "$status $capacity$modelName via $protocol ($temp, $hours, $powerOn, v$firmwareVersion) - $selftest"
|
||||
Write-Host "$status $capacity$modelName via $protocol ($temp, $hours, $powerOn, v$firmwareVersion, $selftest)"
|
||||
}
|
||||
#Write-Progress -completed "Done."
|
||||
exit 0 # success
|
||||
@ -116,4 +119,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-smart-devices.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-smart-devices.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script queries the software status of the local computer and pri
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-software.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-software.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -61,8 +61,7 @@ Write-Host "`n S O F T W A R E" -foregroundColor green
|
||||
& "$PSScriptRoot/check-powershell.ps1"
|
||||
& "$PSScriptRoot/check-time-zone.ps1"
|
||||
& "$PSScriptRoot/check-swap-space.ps1"
|
||||
& "$PSScriptRoot/check-pending-reboot.ps1"
|
||||
exit 0 # success
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-software.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-software.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script checks the given subnet mask for validity.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-subnet-mask.ps1 [[-address] <String>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-subnet-mask.ps1 [[-address] <String>] [<CommonParameters>]
|
||||
|
||||
-address <String>
|
||||
Specifies the subnet mask to check
|
||||
@ -26,7 +26,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./check-subnet-mask.ps1 255.255.255.0
|
||||
✔️ subnet mask 255.255.255.0 is valid
|
||||
✅ subnet mask 255.255.255.0 is valid
|
||||
|
||||
```
|
||||
|
||||
@ -50,7 +50,7 @@ Script Content
|
||||
Specifies the subnet mask to check
|
||||
.EXAMPLE
|
||||
PS> ./check-subnet-mask.ps1 255.255.255.0
|
||||
✔️ subnet mask 255.255.255.0 is valid
|
||||
✅ subnet mask 255.255.255.0 is valid
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -72,7 +72,7 @@ try {
|
||||
if ($address -eq "" ) { $address = read-host "Enter subnet mask to validate" }
|
||||
|
||||
if (IsSubNetMaskValid $address) {
|
||||
"✔️ subnet mask $Address is valid"
|
||||
"✅ subnet mask $Address is valid"
|
||||
exit 0 # success
|
||||
} else {
|
||||
write-warning "Invalid subnet mask: $address"
|
||||
@ -84,4 +84,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-subnet-mask.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-subnet-mask.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script queries the current status of the swap space and prints i
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-swap-space.ps1 [[-minLevel] <Int32>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-swap-space.ps1 [[-minLevel] <Int32>] [<CommonParameters>]
|
||||
|
||||
-minLevel <Int32>
|
||||
Specifies the minimum level in MB (10 MB by default)
|
||||
@ -26,7 +26,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./check-swap-space.ps1
|
||||
✅ Swap space uses 21% of 1GB - 1005MB free
|
||||
✅ Swap space uses 1GB (21%) of 5GB
|
||||
|
||||
```
|
||||
|
||||
@ -50,7 +50,7 @@ Script Content
|
||||
Specifies the minimum level in MB (10 MB by default)
|
||||
.EXAMPLE
|
||||
PS> ./check-swap-space.ps1
|
||||
✅ Swap space uses 21% of 1GB - 1005MB free
|
||||
✅ Swap space uses 1GB (21%) of 5GB
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -91,14 +91,14 @@ try {
|
||||
if ($total -eq 0) {
|
||||
Write-Output "⚠️ No swap space configured"
|
||||
} elseif ($free -eq 0) {
|
||||
Write-Output "⚠️ Swap space of $(MB2String $total) is full"
|
||||
Write-Output "⚠️ Swap space with $(MB2String $total) is FULL !!!"
|
||||
} 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) left!"
|
||||
} elseif ($used -lt 3) {
|
||||
Write-Output "✅ Swap space unused - full $(MB2String $free) free"
|
||||
Write-Output "✅ Swap space has $(MB2String $total) reserved"
|
||||
} else {
|
||||
[int64]$percent = ($used * 100) / $total
|
||||
Write-Output "✅ Swap space at $percent% of $(MB2String $total) - $(MB2String $free) free"
|
||||
Write-Output "✅ Swap space uses $(MB2String $used) ($percent%) of $(MB2String $total)"
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
@ -107,4 +107,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-swap-space.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-swap-space.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -7,7 +7,7 @@ It returns the number of broken symlinks as exit value.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-symlinks.ps1 [[-Folder] <String>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-symlinks.ps1 [[-Folder] <String>] [<CommonParameters>]
|
||||
|
||||
-Folder <String>
|
||||
Specifies the path to the folder
|
||||
@ -28,7 +28,7 @@ Example
|
||||
```powershell
|
||||
PS> ./check-symlinks C:\Users
|
||||
⏳ Checking symlinks at 📂C:\Users including subfolders...
|
||||
✔️ Found 0 broken symlinks at 📂C:\Users in 60 sec
|
||||
✅ Found 0 broken symlinks at 📂C:\Users in 60 sec
|
||||
|
||||
```
|
||||
|
||||
@ -54,7 +54,7 @@ Script Content
|
||||
.EXAMPLE
|
||||
PS> ./check-symlinks C:\Users
|
||||
⏳ Checking symlinks at 📂C:\Users including subfolders...
|
||||
✔️ Found 0 broken symlinks at 📂C:\Users in 60 sec
|
||||
✅ Found 0 broken symlinks at 📂C:\Users in 60 sec
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -87,11 +87,11 @@ try {
|
||||
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
if ($NumTotal -eq 0) {
|
||||
"✔️ No symlink found at 📂$FullPath in $Elapsed sec"
|
||||
"✅ No symlink found at 📂$FullPath in $Elapsed sec"
|
||||
} elseif ($NumBroken -eq 1) {
|
||||
"✔️ Found $NumBroken broken symlink at 📂$FullPath in $Elapsed sec"
|
||||
"✅ Found $NumBroken broken symlink at 📂$FullPath in $Elapsed sec"
|
||||
} else {
|
||||
"✔️ Found $NumBroken broken symlinks at 📂$FullPath in $Elapsed sec"
|
||||
"✅ Found $NumBroken broken symlinks at 📂$FullPath in $Elapsed sec"
|
||||
}
|
||||
exit $NumBroken
|
||||
} catch {
|
||||
@ -100,4 +100,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-symlinks.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-symlinks.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script queries the local time zone and prints it.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-time-zone.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-time-zone.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -17,7 +17,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./check-time-zone.ps1
|
||||
✅ 3:27 PM in W. Europe Summer Time (UTC+01:00:00 +1h DST)
|
||||
✅ 3:27 PM West Europe Summer Time (UTC+01:00:00 +1h DST)
|
||||
|
||||
```
|
||||
|
||||
@ -39,7 +39,7 @@ Script Content
|
||||
This PowerShell script queries the local time zone and prints it.
|
||||
.EXAMPLE
|
||||
PS> ./check-time-zone.ps1
|
||||
✅ 3:27 PM in W. Europe Summer Time (UTC+01:00:00 +1h DST)
|
||||
✅ 3:27 PM West Europe Summer Time (UTC+01:00:00 +1h DST)
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -58,7 +58,7 @@ try {
|
||||
$TZName = $TZ.StandardName
|
||||
$DST=""
|
||||
}
|
||||
Write-Host "✅ $Time in $TZName (UTC+$($offset)$($DST))"
|
||||
Write-Host "✅ $Time $TZName (UTC+$($offset)$($DST))"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -66,4 +66,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-time-zone.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-time-zone.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -44,6 +44,15 @@ function TimeSpanAsString([TimeSpan]$uptime)
|
||||
}
|
||||
}
|
||||
|
||||
function Test-RegistryValue { param([parameter(Mandatory=$true)][ValidateNotNullOrEmpty()]$Path, [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()]$Value)
|
||||
try {
|
||||
Get-ItemProperty -Path $Path -Name $Value -EA Stop
|
||||
return $true
|
||||
} catch {
|
||||
return $false
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
[system.threading.thread]::currentthread.currentculture = [system.globalization.cultureinfo]"en-US"
|
||||
if ($IsLinux) {
|
||||
@ -53,7 +62,51 @@ try {
|
||||
$lastBootTime = (Get-CimInstance Win32_OperatingSystem).LastBootUpTime
|
||||
$uptime = New-TimeSpan -Start $lastBootTime -End (Get-Date)
|
||||
}
|
||||
Write-Host "✅ $(hostname) is up for $(TimeSpanAsString $uptime) since $($lastBootTime.ToShortDateString())"
|
||||
$status = "✅"
|
||||
$pending = ""
|
||||
if ($IsLinux) {
|
||||
if (Test-Path "/var/run/reboot-required") {
|
||||
$status = "⚠️"
|
||||
$pending = "with pending reboot (found /var/run/reboot-required)"
|
||||
}
|
||||
} else {
|
||||
$reason = ""
|
||||
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired") {
|
||||
$reason += ", ...\Auto Update\RebootRequired"
|
||||
}
|
||||
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\PostRebootReporting") {
|
||||
$reason += ", ...\Auto Update\PostRebootReporting"
|
||||
}
|
||||
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending") {
|
||||
$reason += ", ...\Component Based Servicing\RebootPending"
|
||||
}
|
||||
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\ServerManager\CurrentRebootAttempts") {
|
||||
$reason += ", ...\ServerManager\CurrentRebootAttempts"
|
||||
}
|
||||
if (Test-RegistryValue -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing" -Value "RebootInProgress") {
|
||||
$reason += ", ...\CurrentVersion\Component Based Servicing with 'RebootInProgress'"
|
||||
}
|
||||
if (Test-RegistryValue -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing" -Value "PackagesPending") {
|
||||
$reason += ", '...\CurrentVersion\Component Based Servicing' with 'PackagesPending'"
|
||||
}
|
||||
if (Test-RegistryValue -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" -Value "PendingFileRenameOperations2") {
|
||||
$reason += ", '...\CurrentControlSet\Control\Session Manager' with 'PendingFileRenameOperations2'"
|
||||
}
|
||||
if (Test-RegistryValue -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" -Value "DVDRebootSignal") {
|
||||
$reason += ", '...\Windows\CurrentVersion\RunOnce' with 'DVDRebootSignal'"
|
||||
}
|
||||
if (Test-RegistryValue -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon" -Value "JoinDomain") {
|
||||
$reason += ", '...\CurrentControlSet\Services\Netlogon' with 'JoinDomain'"
|
||||
}
|
||||
if (Test-RegistryValue -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon" -Value "AvoidSpnSet") {
|
||||
$reason += ", '...\CurrentControlSet\Services\Netlogon' with 'AvoidSpnSet'"
|
||||
}
|
||||
if ($reason -ne "") {
|
||||
$status = "⚠️"
|
||||
$pending = "with pending reboot ($($reason.substring(2)) in registry)"
|
||||
}
|
||||
}
|
||||
Write-Host "$status $(hostname) is up for $(TimeSpanAsString $uptime) since $($lastBootTime.ToShortDateString()) $pending"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -61,4 +114,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-uptime.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-uptime.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script queries the status of the VPN connection(s) and prints it
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-vpn.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-vpn.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -65,4 +65,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-vpn.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-vpn.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script checks the current weather report.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-weather.ps1 [[-location] <String>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-weather.ps1 [[-location] <String>] [<CommonParameters>]
|
||||
|
||||
-location <String>
|
||||
Specifies the location to use (determined automatically per default)
|
||||
@ -81,4 +81,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-weather.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-weather.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script determines and speaks the current week number by text-to-
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-week.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-week.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -54,4 +54,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-week.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-week.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script determines the current wind conditions and replies by tex
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-wind.ps1 [[-location] <String>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-wind.ps1 [[-location] <String>] [<CommonParameters>]
|
||||
|
||||
-location <String>
|
||||
Specifies the location to use (determined automatically per default)
|
||||
@ -72,4 +72,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-wind.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-wind.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script checks the validity of the Windows system files. It requi
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-windows-system-files.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-windows-system-files.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -17,7 +17,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./check-windows-system-files.ps1
|
||||
✔️ checked Windows system files
|
||||
✅ checked Windows system files
|
||||
|
||||
```
|
||||
|
||||
@ -39,7 +39,7 @@ Script Content
|
||||
This PowerShell script checks the validity of the Windows system files. It requires admin rights.
|
||||
.EXAMPLE
|
||||
PS> ./check-windows-system-files.ps1
|
||||
✔️ checked Windows system files
|
||||
✅ checked Windows system files
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -52,7 +52,7 @@ try {
|
||||
sfc /verifyOnly
|
||||
if ($lastExitCode -ne "0") { throw "'sfc /verifyOnly' failed" }
|
||||
|
||||
"✔️ checked Windows system files"
|
||||
"✅ checked Windows system files"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -60,4 +60,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-windows-system-files.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-windows-system-files.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script checks the given XML file for validity.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-xml-file.ps1 [[-path] <String>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-xml-file.ps1 [[-path] <String>] [<CommonParameters>]
|
||||
|
||||
-path <String>
|
||||
Specifies the path to the XML file
|
||||
@ -26,7 +26,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./check-xml-file.ps1 myfile.xml
|
||||
✔️ Valid XML in 📄myfile.xml
|
||||
✅ Valid XML in 📄myfile.xml
|
||||
|
||||
```
|
||||
|
||||
@ -50,7 +50,7 @@ Script Content
|
||||
Specifies the path to the XML file
|
||||
.EXAMPLE
|
||||
PS> ./check-xml-file.ps1 myfile.xml
|
||||
✔️ Valid XML in 📄myfile.xml
|
||||
✅ Valid XML in 📄myfile.xml
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -77,7 +77,7 @@ try {
|
||||
|
||||
if ($script:ErrorCount -gt 0) { throw "Invalid XML" }
|
||||
|
||||
"✔️ Valid XML in 📄$path"
|
||||
"✅ Valid XML in 📄$path"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ $($Error[0]) in 📄$path"
|
||||
@ -85,4 +85,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-xml-file.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-xml-file.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script verifies any XML file (with suffix .xml) in the given dir
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-xml-files.ps1 [[-path] <String>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/check-xml-files.ps1 [[-path] <String>] [<CommonParameters>]
|
||||
|
||||
-path <String>
|
||||
Specifies the path to the directory tree (current working dir by default)
|
||||
@ -27,7 +27,7 @@ Example
|
||||
```powershell
|
||||
PS> ./check-xml-files.ps1 C:\Windows
|
||||
...
|
||||
✔️ Checked 3387 XML files (2462 invalid, 925 valid) within 📂C:\Windows in 116 sec
|
||||
✅ Checked 3387 XML files (2462 invalid, 925 valid) within 📂C:\Windows in 116 sec
|
||||
|
||||
```
|
||||
|
||||
@ -52,7 +52,7 @@ Script Content
|
||||
.EXAMPLE
|
||||
PS> ./check-xml-files.ps1 C:\Windows
|
||||
...
|
||||
✔️ Checked 3387 XML files (2462 invalid, 925 valid) within 📂C:\Windows in 116 sec
|
||||
✅ Checked 3387 XML files (2462 invalid, 925 valid) within 📂C:\Windows in 116 sec
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -75,7 +75,7 @@ try {
|
||||
|
||||
[int]$total = $valid + $invalid
|
||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||
"✔️ Checked $total XML files ($invalid invalid, $valid valid) 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 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-xml-files.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -7,7 +7,7 @@ NOTE: To be used with care! This cannot be undone!
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./clean-repo.ps1 [[-path] <String>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/clean-repo.ps1 [[-path] <String>] [<CommonParameters>]
|
||||
|
||||
-path <String>
|
||||
Specifies the file path to the local Git repository (current working directory by default)
|
||||
@ -31,7 +31,7 @@ PS> ./clean-repo.ps1 C:\Repos\rust
|
||||
⏳ (2/4) Checking local repository... C:\Repos\rust
|
||||
⏳ (3/4) Removing untracked files in repository...
|
||||
⏳ (4/4) Removing untracked files in submodules...
|
||||
✔️ Cleaned up 📂rust repository in 2s.
|
||||
✅ Cleaned up 📂rust repo in 2s.
|
||||
|
||||
```
|
||||
|
||||
@ -60,7 +60,7 @@ Script Content
|
||||
⏳ (2/4) Checking local repository... C:\Repos\rust
|
||||
⏳ (3/4) Removing untracked files in repository...
|
||||
⏳ (4/4) Removing untracked files in submodules...
|
||||
✔️ Cleaned up 📂rust repository in 2s.
|
||||
✅ Cleaned up 📂rust repo in 2s.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -93,7 +93,7 @@ try {
|
||||
if ($lastExitCode -ne "0") { throw "'git clean' in the submodules failed with exit code $lastExitCode" }
|
||||
|
||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||
"✔️ Cleaned up 📂$repoName repository in $($elapsed)s."
|
||||
"✅ Cleaned up 📂$repoName repo in $($elapsed)s."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -101,4 +101,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clean-repo.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clean-repo.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script cleans all Git repositories in a folder from untracked fi
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./clean-repos.ps1 [[-parentDir] <String>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/clean-repos.ps1 [[-parentDir] <String>] [<CommonParameters>]
|
||||
|
||||
-parentDir <String>
|
||||
Specifies the path to the parent folder (current working dir by default)
|
||||
@ -92,7 +92,7 @@ try {
|
||||
if ($lastExitCode -ne "0") { throw "'git clean -xfd -f' in submodules failed with exit code $lastExitCode" }
|
||||
}
|
||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||
"✔️ Cleaned $numFolders Git repos under 📂$parentDirName in $elapsed sec"
|
||||
"✅ Cleaned $numFolders Git repos under 📂$parentDirName in $elapsed sec"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -100,4 +100,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clean-repos.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clean-repos.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script clears the DNS client cache of the local computer.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./clear-dns-cache.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/clear-dns-cache.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -17,7 +17,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./clear-dns-cache.ps1
|
||||
✔️ Cleared DNS cache in 1 sec
|
||||
✅ Cleared DNS cache in 1s.
|
||||
|
||||
```
|
||||
|
||||
@ -39,7 +39,7 @@ Script Content
|
||||
This PowerShell script clears the DNS client cache of the local computer.
|
||||
.EXAMPLE
|
||||
PS> ./clear-dns-cache.ps1
|
||||
✔️ Cleared DNS cache in 1 sec
|
||||
✅ Cleared DNS cache in 1s.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -47,12 +47,12 @@ Script Content
|
||||
#>
|
||||
|
||||
try {
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
Clear-DnsClientCache
|
||||
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
"✔️ Cleared DNS cache in $Elapsed sec"
|
||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||
"✅ Cleared DNS cache in $($elapsed)s."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -60,4 +60,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clear-dns-cache.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clear-dns-cache.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -7,7 +7,7 @@ IMPORTANT NOTE: this cannot be undo!
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./clear-recycle-bin.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/clear-recycle-bin.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -58,4 +58,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clear-recycle-bin.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clear-recycle-bin.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script clones popular Git repositories into a common target dire
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./clone-repos.ps1 [[-targetDir] <String>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/clone-repos.ps1 [[-targetDir] <String>] [<CommonParameters>]
|
||||
|
||||
-targetDir <String>
|
||||
Specifies the file path to the target directory (current working directory by default)
|
||||
@ -26,8 +26,11 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./clone-repos C:\MyRepos
|
||||
⏳ (1) Searching for Git executable... git version 2.46.0.windows.1
|
||||
⏳ (2) Reading data/popular-repos.csv... 29 repos
|
||||
⏳ (3) Checking target folder... 📂Repos
|
||||
⏳ (4/32) Cloning 📂base256 (dev tool) from git@github.com:fleschutz/talk2windows.git (shallow main branch)...
|
||||
...
|
||||
✔️ Cloned 29 additional Git repos into 📂MyRepos in 123s.
|
||||
|
||||
```
|
||||
|
||||
@ -51,8 +54,11 @@ Script Content
|
||||
Specifies the file path to the target directory (current working directory by default)
|
||||
.EXAMPLE
|
||||
PS> ./clone-repos C:\MyRepos
|
||||
⏳ (1) Searching for Git executable... git version 2.46.0.windows.1
|
||||
⏳ (2) Reading data/popular-repos.csv... 29 repos
|
||||
⏳ (3) Checking target folder... 📂Repos
|
||||
⏳ (4/32) Cloning 📂base256 (dev tool) from git@github.com:fleschutz/talk2windows.git (shallow main branch)...
|
||||
...
|
||||
✔️ Cloned 29 additional Git repos into 📂MyRepos in 123s.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -89,22 +95,22 @@ try {
|
||||
$step++
|
||||
|
||||
if (Test-Path "$targetDir/$folderName" -pathType container) {
|
||||
"⏳ ($step/$($total + 3)) Skipping 📂$folderName - the $category exists already..."
|
||||
"⏳ ($step/$($total + 3)) Skipping 📂$folderName ($category): exists already"
|
||||
$skipped++
|
||||
} elseif ($shallow -eq "yes") {
|
||||
"⏳ ($step/$($total + 3)) Cloning into 📂$folderName (a $category, $branch branch, shallow)..."
|
||||
"⏳ ($step/$($total + 3)) Cloning 📂$folderName ($category) from $URL (shallow $branch branch)..."
|
||||
& git clone --branch "$branch" --single-branch --recurse-submodules "$URL" "$targetDir/$folderName"
|
||||
if ($lastExitCode -ne "0") { throw "'git clone --branch $branch $URL' failed with exit code $lastExitCode" }
|
||||
$cloned++
|
||||
} else {
|
||||
"⏳ ($step/$($total + 3)) Cloning into 📂$folderName (a $category, $branch branch, full history)..."
|
||||
"⏳ ($step/$($total + 3)) Cloning 📂$folderName ($category) from $URL (full $branch branch)..."
|
||||
& git clone --branch "$branch" --recurse-submodules "$URL" "$targetDir/$folderName"
|
||||
if ($lastExitCode -ne "0") { throw "'git clone --branch $branch $URL' failed with exit code $lastExitCode" }
|
||||
$clone++
|
||||
}
|
||||
}
|
||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||
"✔️ Cloned $cloned additional Git repos into 📂$targetDirName in $($elapsed)s."
|
||||
"✅ Cloned $cloned additional Git repos into 📂$targetDirName in $($elapsed)s."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -112,4 +118,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clone-repos.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clone-repos.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script clones popular Git repositories into a common target dire
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./clone-shallow.ps1 [[-targetDir] <String>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/clone-shallow.ps1 [[-targetDir] <String>] [<CommonParameters>]
|
||||
|
||||
-targetDir <String>
|
||||
Specifies the file path to the target directory (current working directory by default)
|
||||
@ -66,7 +66,7 @@ try {
|
||||
|
||||
|
||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||
"✔️ Cloned the shallow repository in $elapsed sec"
|
||||
"✅ Cloned the shallow repository in $elapsed sec"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -74,4 +74,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clone-shallow.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clone-shallow.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
@ -6,7 +6,7 @@ This PowerShell script closes the calculator application gracefully.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./close-calculator.ps1 [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/close-calculator.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -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 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of close-calculator.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user