mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-23 16:33:20 +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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```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>
|
-PathToExecutables <String>
|
||||||
Specifies the path to the executables.
|
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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./alert.ps1 [[-Message] <String>] [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/alert.ps1 [[-Message] <String>] [<CommonParameters>]
|
||||||
|
|
||||||
-Message <String>
|
-Message <String>
|
||||||
Specifies the alert message
|
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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./build-repo.ps1 [[-path] <String>] [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/build-repo.ps1 [[-path] <String>] [<CommonParameters>]
|
||||||
|
|
||||||
-path <String>
|
-path <String>
|
||||||
Specifies the path to the Git repository (default is current working directory)
|
Specifies the path to the Git repository (default is current working directory)
|
||||||
@ -28,7 +28,7 @@ Example
|
|||||||
PS> ./build-repo.ps1 C:\Repos\ninja
|
PS> ./build-repo.ps1 C:\Repos\ninja
|
||||||
⏳ Building 📂ninja using CMakeLists.txt into 📂ninja/_Build_Results...
|
⏳ 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
|
PS> ./build-repo.ps1 C:\Repos\ninja
|
||||||
⏳ Building 📂ninja using CMakeLists.txt into 📂ninja/_Build_Results...
|
⏳ Building 📂ninja using CMakeLists.txt into 📂ninja/_Build_Results...
|
||||||
...
|
...
|
||||||
✔️ Built 📂ninja repository in 47 sec.
|
✅ Built 📂ninja repository in 47 sec.
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -188,7 +188,7 @@ try {
|
|||||||
|
|
||||||
$repoDirName = (Get-Item "$path").Name
|
$repoDirName = (Get-Item "$path").Name
|
||||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||||
"✔️ Built 📂$repoDirName repository in $elapsed sec."
|
"✅ Built 📂$repoDirName repository in $elapsed sec."
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ 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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./build-repos.ps1 [[-ParentDir] <String>] [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/build-repos.ps1 [[-ParentDir] <String>] [<CommonParameters>]
|
||||||
|
|
||||||
-ParentDir <String>
|
-ParentDir <String>
|
||||||
Specifies the path to the parent folder
|
Specifies the path to the parent folder
|
||||||
@ -74,7 +74,7 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
[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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ 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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-autostart.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/cd-autostart.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -47,12 +47,12 @@ Script Content
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = Resolve-Path "$HOME/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup"
|
$path = Resolve-Path "~/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup"
|
||||||
if (-not(Test-Path "$Path" -pathType container)) {
|
if (-not(Test-Path "$path" -pathType container)) {
|
||||||
throw "Autostart folder at 📂$Path doesn't exist (yet)"
|
throw "Autostart folder at 📂$path doesn't exist (yet)"
|
||||||
}
|
}
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-crashdumps.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/cd-crashdumps.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-desktop.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/cd-desktop.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -48,20 +48,20 @@ Script Content
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
$Path = Resolve-Path "~/Desktop"
|
$path = Resolve-Path "~/Desktop"
|
||||||
} else {
|
} else {
|
||||||
$Path = [Environment]::GetFolderPath('DesktopDirectory')
|
$path = [Environment]::GetFolderPath('DesktopDirectory')
|
||||||
}
|
}
|
||||||
if (Test-Path "$Path" -pathType container) {
|
if (Test-Path "$path" -pathType container) {
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
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 {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
exit 1
|
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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-docs.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/cd-docs.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -48,15 +48,15 @@ Script Content
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
$Path = Resolve-Path "$HOME/Documents"
|
$path = Resolve-Path "~/Documents"
|
||||||
} else {
|
} else {
|
||||||
$Path = [Environment]::GetFolderPath('MyDocuments')
|
$path = [Environment]::GetFolderPath('MyDocuments')
|
||||||
}
|
}
|
||||||
if (-not(Test-Path "$Path" -pathType container)) {
|
if (-not(Test-Path "$path" -pathType container)) {
|
||||||
throw "Documents folder at 📂$Path doesn't exist (yet)"
|
throw "Documents folder at 📂$path doesn't exist (yet)"
|
||||||
}
|
}
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-downloads.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/cd-downloads.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -48,20 +48,20 @@ Script Content
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
$Path = Resolve-Path "~/Downloads"
|
$path = Resolve-Path "~/Downloads"
|
||||||
} else {
|
} 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) {
|
if (Test-Path "$path" -pathType container) {
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
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 {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
exit 1
|
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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-dropbox.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/cd-dropbox.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -47,17 +47,15 @@ Script Content
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = Resolve-Path "$HOME/Dropbox"
|
$path = Resolve-Path "~/Dropbox"
|
||||||
if (-not(Test-Path "$Path" -pathType container)) {
|
if (-not(Test-Path "$path" -pathType container)) { throw "No Dropbox folder at 📂$path - is Dropbox installed?" }
|
||||||
throw "Dropbox folder at 📂$Path doesn't exist (yet)"
|
Set-Location "$path"
|
||||||
}
|
"📂$path"
|
||||||
Set-Location "$Path"
|
|
||||||
"📂$Path"
|
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error: $($Error[0])"
|
||||||
exit 1
|
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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-etc.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/cd-etc.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -48,15 +48,15 @@ Script Content
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinx) {
|
if ($IsLinx) {
|
||||||
$Path = "/etc"
|
$path = "/etc"
|
||||||
} else {
|
} else {
|
||||||
$Path = Resolve-Path "$env:WINDIR\System32\drivers\etc"
|
$path = Resolve-Path "$env:WINDIR\System32\drivers\etc"
|
||||||
}
|
}
|
||||||
if (-not(Test-Path "$Path" -pathType container)) {
|
if (-not(Test-Path "$path" -pathType container)) {
|
||||||
throw "/etc directory at 📂$Path doesn't exist (yet)"
|
throw "/etc directory at 📂$path doesn't exist (yet)"
|
||||||
}
|
}
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-fonts.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/cd-fonts.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -47,12 +47,12 @@ Script Content
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = [Environment]::GetFolderPath('Fonts')
|
$path = [Environment]::GetFolderPath('Fonts')
|
||||||
if (-not(Test-Path "$Path" -pathType container)) {
|
if (-not(Test-Path "$path" -pathType container)) {
|
||||||
throw "Fonts folder at 📂$Path doesn't exist (yet)"
|
throw "Fonts folder at 📂$path doesn't exist (yet)"
|
||||||
}
|
}
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-home.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/cd-home.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -16,7 +16,7 @@ PS> ./cd-home.ps1 [<CommonParameters>]
|
|||||||
Example
|
Example
|
||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-home
|
PS> ./cd-home.ps1
|
||||||
📂C:\Users\Markus
|
📂C:\Users\Markus
|
||||||
|
|
||||||
```
|
```
|
||||||
@ -38,7 +38,7 @@ Script Content
|
|||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script changes the working directory to the user's home directory.
|
This PowerShell script changes the working directory to the user's home directory.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-home
|
PS> ./cd-home.ps1
|
||||||
📂C:\Users\Markus
|
📂C:\Users\Markus
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
@ -47,17 +47,15 @@ Script Content
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = Resolve-Path -Path "~"
|
$path = Resolve-Path "~"
|
||||||
if (Test-Path "$Path" -pathType container) {
|
if (-not(Test-Path "$path" -pathType container)) { throw "Home folder at $path doesn't exist (yet)" }
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
}
|
|
||||||
throw "User's home folder at 📂$Path doesn't exist (yet)"
|
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
exit 1
|
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 {
|
try {
|
||||||
$Path = GetLogsDir
|
$path = GetLogsDir
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-music.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/cd-music.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -48,20 +48,20 @@ Script Content
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
$Path = Resolve-Path "~/Music"
|
$path = Resolve-Path "~/Music"
|
||||||
} else {
|
} else {
|
||||||
$Path = [Environment]::GetFolderPath('MyMusic')
|
$path = [Environment]::GetFolderPath('MyMusic')
|
||||||
}
|
}
|
||||||
if (Test-Path "$Path" -pathType container) {
|
if (Test-Path "$path" -pathType container) {
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
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 {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
exit 1
|
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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-onedrive.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/cd-onedrive.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -47,17 +47,15 @@ Script Content
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = Resolve-Path "$HOME/OneDrive"
|
$path = Resolve-Path "~/OneDrive"
|
||||||
if (-not(Test-Path "$Path" -pathType container)) {
|
if (-not(Test-Path "$path" -pathType container)) { throw "No OneDrive folder at 📂$path - is OneDrive installed?" }
|
||||||
throw "OneDrive folder at 📂$Path doesn't exist (yet)"
|
Set-Location "$path"
|
||||||
}
|
"📂$path"
|
||||||
Set-Location "$Path"
|
|
||||||
"📂$Path"
|
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error: $($Error[0])"
|
||||||
exit 1
|
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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-pics.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/cd-pics.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -48,13 +48,13 @@ Script Content
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
$Path = Resolve-Path "$HOME/Pictures"
|
$path = Resolve-Path "~/Pictures"
|
||||||
} else {
|
} 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)" }
|
if (-not(Test-Path "$path" -pathType container)) { throw "Pictures folder at 📂$path doesn't exist (yet)" }
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-public.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/cd-public.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -48,13 +48,13 @@ Script Content
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
$Path = Resolve-Path "~/Public"
|
$path = Resolve-Path "~/Public"
|
||||||
} else {
|
} 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)" }
|
if (-not(Test-Path "$path" -pathType container)) { throw "Public folder at 📂$path doesn't exist (yet)" }
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-recent.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/cd-recent.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -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 {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
$path = "$HOME/.local/share/Trash/"
|
$path = "~/.local/share/Trash/"
|
||||||
} else {
|
} else {
|
||||||
$path = "C:\`$Recycle.Bin\$(GetCurrentUserSID)"
|
$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*
|
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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-repo.ps1 [[-folderName] <String>] [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/cd-repo.ps1 [[-folderName] <String>] [<CommonParameters>]
|
||||||
|
|
||||||
-folderName <String>
|
-folderName <String>
|
||||||
Specifies the Git repository's folder name
|
Specifies the folder name of the Git repository
|
||||||
|
|
||||||
Required? false
|
Required? false
|
||||||
Position? 1
|
Position? 1
|
||||||
@ -26,7 +26,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-repo.ps1 rust
|
PS> ./cd-repo.ps1 rust
|
||||||
📂C:\Repos\rust - current branch is: ## main ... origin/main
|
📂C:\Repos\rust · on branch: ## main ... origin/main
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -43,14 +43,14 @@ Script Content
|
|||||||
```powershell
|
```powershell
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Sets the working directory to a repository
|
Sets the working directory to a repo
|
||||||
.DESCRIPTION
|
.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
|
.PARAMETER folderName
|
||||||
Specifies the Git repository's folder name
|
Specifies the folder name of the Git repository
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-repo.ps1 rust
|
PS> ./cd-repo.ps1 rust
|
||||||
📂C:\Repos\rust - current branch is: ## main ... origin/main
|
📂C:\Repos\rust · on branch: ## main ... origin/main
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -62,25 +62,26 @@ param([string]$folderName = "")
|
|||||||
try {
|
try {
|
||||||
if ("$folderName" -eq "") { $folderName = Read-Host "Enter the Git repository's folder name" }
|
if ("$folderName" -eq "") { $folderName = Read-Host "Enter the Git repository's folder name" }
|
||||||
|
|
||||||
if (Test-Path "$HOME/Repos/" -pathType Container) { # try short name
|
if (Test-Path "~/Repos/" -pathType container) { # try short name
|
||||||
$path = "$HOME/Repos/"
|
$path = "~/Repos/"
|
||||||
} elseif (Test-Path "$HOME/repos/" -pathType Container) {
|
} elseif (Test-Path "~/repos/" -pathType container) {
|
||||||
$path = "$HOME/repos/"
|
$path = "~/repos/"
|
||||||
} elseif (Test-Path "$HOME/Repositories/" -pathType Container) { # try long name
|
} elseif (Test-Path "~/Repositories/" -pathType container) { # try long name
|
||||||
$path = "$HOME/Repositories/"
|
$path = "~/Repositories/"
|
||||||
} elseif (Test-Path "$HOME/source/repos/" -pathType Container) { # try Visual Studio default
|
} elseif (Test-Path "~/source/repos/" -pathType container) { # try Visual Studio default
|
||||||
$path = "$HOME/source/repos/"
|
$path = "~/source/repos/"
|
||||||
} elseif (Test-Path "/Repos/" -pathType Container) {
|
} elseif (Test-Path "/Repos/" -pathType container) {
|
||||||
$path = "/Repos/"
|
$path = "/Repos/"
|
||||||
} else {
|
} else {
|
||||||
throw "The folder for Git repositories doesn't exist (yet)"
|
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"
|
$path = Resolve-Path "$path"
|
||||||
Set-Location "$path"
|
Set-Location "$path"
|
||||||
Write-Host "📂$path - current branch is: " -noNewline
|
Write-Host "📂$path · on branch: " -noNewline
|
||||||
& git status --short --branch --show-stash
|
& git status --short --branch --show-stash
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} 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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-repos.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/cd-repos.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -49,14 +49,14 @@ Script Content
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (Test-Path "$HOME/Repos/" -pathType Container) { # try short name
|
if (Test-Path "~/Repos/" -pathType Container) { # try short name
|
||||||
$path = "$HOME/Repos/"
|
$path = "~/Repos/"
|
||||||
} elseif (Test-Path "$HOME/repos/" -pathType Container) {
|
} elseif (Test-Path "~/repos/" -pathType Container) {
|
||||||
$path = "$HOME/repos/"
|
$path = "~/repos/"
|
||||||
} elseif (Test-Path "$HOME/Repositories/" -pathType Container) { # try long name
|
} elseif (Test-Path "~/Repositories/" -pathType Container) { # try long name
|
||||||
$path = "$HOME/Repositories/"
|
$path = "~/Repositories/"
|
||||||
} elseif (Test-Path "$HOME/source/repos/" -pathType Container) { # try Visual Studio default
|
} elseif (Test-Path "~/source/repos/" -pathType Container) { # try Visual Studio default
|
||||||
$path = "$HOME/source/repos/"
|
$path = "~/source/repos/"
|
||||||
} elseif (Test-Path "/Repos/" -pathType Container) {
|
} elseif (Test-Path "/Repos/" -pathType Container) {
|
||||||
$path = "/Repos/"
|
$path = "/Repos/"
|
||||||
} else {
|
} 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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-root.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/cd-root.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -47,9 +47,9 @@ Script Content
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) { $Path = "/" } else { $Path = "C:\" }
|
if ($IsLinux) { $path = "/" } else { $path = "C:\" }
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -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 {
|
function GetScreenshotsFolder {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
$Path = "$HOME/Pictures"
|
$path = "~/Pictures"
|
||||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Pictures folder at $Path doesn't exist (yet)" }
|
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" }
|
if (Test-Path "$path/Screenshots" -pathType container) { $path = "$path/Screenshots" }
|
||||||
} else {
|
} 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)" }
|
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" }
|
if (Test-Path "$path\Screenshots" -pathType container) { $path = "$path\Screenshots" }
|
||||||
}
|
}
|
||||||
return $Path
|
return $path
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = GetScreenshotsFolder
|
$path = GetScreenshotsFolder
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-scripts.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/cd-scripts.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -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*
|
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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-ssh.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/cd-ssh.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -16,7 +16,7 @@ PS> ./cd-ssh.ps1 [<CommonParameters>]
|
|||||||
Example
|
Example
|
||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-ssh
|
PS> ./cd-ssh.ps1
|
||||||
📂C:\Users\Markus\.ssh
|
📂C:\Users\Markus\.ssh
|
||||||
|
|
||||||
```
|
```
|
||||||
@ -34,11 +34,11 @@ Script Content
|
|||||||
```powershell
|
```powershell
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Sets the working directory to the user's SSH folder
|
Sets the working directory to the SSH folder
|
||||||
.DESCRIPTION
|
.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
|
.EXAMPLE
|
||||||
PS> ./cd-ssh
|
PS> ./cd-ssh.ps1
|
||||||
📂C:\Users\Markus\.ssh
|
📂C:\Users\Markus\.ssh
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
@ -47,15 +47,16 @@ Script Content
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = Resolve-Path "~/.ssh"
|
$path = "~/.ssh"
|
||||||
if (-not(Test-Path "$Path" -pathType container)) { throw "User's SSH folder at 📂$Path doesn't exist (yet)" }
|
if (-not(Test-Path "$path" -pathType container)) { throw "Your secure shell (SSH) folder at 📂$path doesn't exist (yet)" }
|
||||||
Set-Location "$Path"
|
$path = Resolve-Path "$path"
|
||||||
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$Path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error: $($Error[0])"
|
||||||
exit 1
|
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 {
|
try {
|
||||||
$Path = GetTempDir
|
$path = GetTempDir
|
||||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Temporary folder at 📂$Path doesn't exist (yet)" }
|
if (-not(Test-Path "$path" -pathType container)) { throw "Temporary folder at 📂$path doesn't exist (yet)" }
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-templates.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/cd-templates.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -48,13 +48,13 @@ Script Content
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
$Path = Resolve-Path "~/Templates"
|
$path = Resolve-Path "~/Templates"
|
||||||
} else {
|
} 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)" }
|
if (-not(Test-Path "$path" -pathType container)) { throw "Templates folder at 📂$path doesn't exist (yet)" }
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -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 {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
$path = "$HOME/.local/share/Trash/"
|
$path = "~/.local/share/Trash/"
|
||||||
} else {
|
} else {
|
||||||
$path = "C:\`$Recycle.Bin\$(GetCurrentUserSID)"
|
$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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-up.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/cd-up.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -47,10 +47,10 @@ Script Content
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = Resolve-Path ".."
|
$path = Resolve-Path ".."
|
||||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Folder at 📂$Path doesn't exist (yet)" }
|
if (-not(Test-Path "$path" -pathType container)) { throw "Folder at 📂$path doesn't exist (yet)" }
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-up2.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/cd-up2.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -47,10 +47,10 @@ Script Content
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = Resolve-Path "../.."
|
$path = Resolve-Path "../.."
|
||||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Folder at 📂$Path doesn't exist (yet)" }
|
if (-not(Test-Path "$path" -pathType container)) { throw "Folder at 📂$path doesn't exist (yet)" }
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-up3.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/cd-up3.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -47,10 +47,10 @@ Script Content
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = Resolve-Path "../../.."
|
$path = Resolve-Path "../../.."
|
||||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Folder at 📂$Path doesn't exist (yet)" }
|
if (-not(Test-Path "$path" -pathType container)) { throw "Folder at 📂$path doesn't exist (yet)" }
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-up4.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/cd-up4.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -47,10 +47,10 @@ Script Content
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = Resolve-Path "../../../.."
|
$path = Resolve-Path "../../../.."
|
||||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Folder at 📂$Path doesn't exist (yet)" }
|
if (-not(Test-Path "$path" -pathType container)) { throw "Folder at 📂$path doesn't exist (yet)" }
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-users.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/cd-users.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -47,10 +47,10 @@ Script Content
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = Resolve-Path "$HOME/.."
|
$path = Resolve-Path "~/.."
|
||||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Users directory at 📂$Path doesn't exist (yet)" }
|
if (-not(Test-Path "$path" -pathType container)) { throw "Users directory at 📂$path doesn't exist (yet)" }
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-videos.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/cd-videos.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -48,13 +48,13 @@ Script Content
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
$Path = Resolve-Path "$HOME/Videos"
|
$path = Resolve-Path "~/Videos"
|
||||||
} else {
|
} 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)" }
|
if (-not(Test-Path "$path" -pathType container)) { throw "Videos folder at 📂$path doesn't exist (yet)" }
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./cd-windows.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/cd-windows.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -47,10 +47,10 @@ Script Content
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = Resolve-Path "$env:WINDIR"
|
$path = Resolve-Path "$env:WINDIR"
|
||||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Windows directory at 📂$Path doesn't exist" }
|
if (-not(Test-Path "$path" -pathType container)) { throw "Windows directory at 📂$path doesn't exist" }
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./change-wallpaper.ps1 [[-Category] <String>] [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/change-wallpaper.ps1 [[-Category] <String>] [<CommonParameters>]
|
||||||
|
|
||||||
-Category <String>
|
-Category <String>
|
||||||
Specifies the photo category (beach, city, ...)
|
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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-admin.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-admin.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -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.
|
This PowerShell script queries the installed applications and prints it.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-apps.ps1
|
PS> ./check-apps.ps1
|
||||||
✅ 119 Windows apps installed, 11 upgrades available
|
⚠️ 150 Win apps installed, 72 upgrades available, 5 crash dump(s) found
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz | License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function GetCrashDumps {
|
function CountCrashDumps {
|
||||||
[string]$path = Resolve-Path -Path "~\AppData\Local\CrashDumps"
|
[string]$path = Resolve-Path -Path "~\AppData\Local\CrashDumps"
|
||||||
$count = 0
|
|
||||||
$files = (Get-ChildItem -path "$path\*.dmp" -attributes !Directory)
|
$files = (Get-ChildItem -path "$path\*.dmp" -attributes !Directory)
|
||||||
foreach($file in $files) { $count++ }
|
return $files.Count
|
||||||
return $count
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$statusIcon = "✅"
|
$status = "✅"
|
||||||
$statusMsg = ""
|
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
Write-Progress "Querying installed applications..."
|
Write-Progress "Querying installed applications..."
|
||||||
$numPkgs = (apt list --installed 2>/dev/null).Count
|
$numPkgs = (apt list --installed 2>/dev/null).Count
|
||||||
$numSnaps = (snap list).Count - 1
|
$numSnaps = (snap list).Count - 1
|
||||||
Write-Progress -completed "Done."
|
Write-Progress -completed "Done."
|
||||||
$statusMsg += "$numPkgs Debian packages, $numSnaps snaps installed"
|
$reply = "$numPkgs Debian packages, $numSnaps snaps installed"
|
||||||
} else {
|
} else {
|
||||||
Write-Progress "Querying installed apps..."
|
Write-Progress "Querying installed apps..."
|
||||||
$Apps = Get-AppxPackage
|
$apps = Get-AppxPackage
|
||||||
Write-Progress -completed "Done."
|
Write-Progress -completed "Done."
|
||||||
$statusMsg = "$($Apps.Count) Win apps installed"
|
$reply = "$($apps.Count) Win apps installed"
|
||||||
|
|
||||||
[int]$numNonOk = 0
|
[int]$numNonOk = 0
|
||||||
foreach($App in $Apps) { if ($App.Status -ne "Ok") { $numNonOk++ } }
|
foreach($app in $apps) { if ($app.Status -ne "Ok") { $numNonOk++ } }
|
||||||
if ($numNonOk -gt 0) { $statusIcon = "⚠️"; $statusMsg += ", $numNonOk non-ok" }
|
if ($numNonOk -gt 0) { $status = "⚠️"; $reply += ", $numNonOk non-ok" }
|
||||||
|
|
||||||
[int]$numErrors = (Get-AppxLastError)
|
[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
|
$numUpdates = (winget upgrade --include-unknown).Count - 5
|
||||||
$statusMsg += ", $numUpdates upgrades available"
|
$reply += ", $numUpdates upgrades available"
|
||||||
|
|
||||||
$crashDumps = GetCrashDumps
|
$numCrashDumps = CountCrashDumps
|
||||||
if ($crashDumps -ne 0) { $statusIcon = "⚠️"; $statusMsg += " - found $crashDumps crash dump(s)" }
|
if ($numCrashDumps -ne 0) { $status = "⚠️"; $reply += ", $numCrashDumps crash dump(s) found" }
|
||||||
}
|
}
|
||||||
Write-Host "$statusIcon $statusMsg"
|
Write-Host "$status $reply"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ 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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-bios.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-bios.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-bios.ps1
|
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.
|
This PowerShell script queries the BIOS status and prints it.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-bios.ps1
|
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
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -48,27 +48,26 @@ Script Content
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
Write-Progress "Querying BIOS details..."
|
|
||||||
$model = (sudo dmidecode -s system-product-name)
|
$model = (sudo dmidecode -s system-product-name)
|
||||||
if ("$model" -ne "") {
|
if ("$model" -eq "") { exit 0 } # no information
|
||||||
$version = (sudo dmidecode -s bios-version)
|
Write-Progress "Querying BIOS details..."
|
||||||
$releaseDate = (sudo dmidecode -s bios-release-date)
|
$version = (sudo dmidecode -s bios-version)
|
||||||
$manufacturer = (sudo dmidecode -s system-manufacturer)
|
$releaseDate = (sudo dmidecode -s bios-release-date)
|
||||||
Write-Host "✅ BIOS model $model by $manufacturer (version $version of $releaseDate)"
|
$manufacturer = (sudo dmidecode -s system-manufacturer)
|
||||||
}
|
Write-Progress -completed "Done."
|
||||||
Write-Progress -completed "."
|
|
||||||
} else {
|
} else {
|
||||||
$BIOS = Get-CimInstance -ClassName Win32_BIOS
|
$details = Get-CimInstance -ClassName Win32_BIOS
|
||||||
$model = $BIOS.Name.Trim()
|
$model = $details.Name.Trim()
|
||||||
$version = $BIOS.Version.Trim()
|
$version = $details.Version.Trim()
|
||||||
$serialNumber = $BIOS.SerialNumber.Trim()
|
$serial = $details.SerialNumber.Trim()
|
||||||
$manufacturer = $BIOS.Manufacturer.Trim()
|
$manufacturer = $details.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)"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ 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
|
$details = Get-WmiObject -Class Win32_Processor
|
||||||
$cpuName = $details.Name.trim()
|
$cpuName = $details.Name.trim()
|
||||||
$arch = "$arch, "
|
$arch = "$arch, "
|
||||||
$deviceID = "$($details.DeviceID), "
|
$deviceID = ", $($details.DeviceID)"
|
||||||
$speed = "$($details.MaxClockSpeed)MHz, "
|
$speed = ", $($details.MaxClockSpeed)MHz"
|
||||||
$socket = "$($details.SocketDesignation) socket"
|
$socket = ", $($details.SocketDesignation) socket"
|
||||||
}
|
}
|
||||||
$cores = [System.Environment]::ProcessorCount
|
$cores = [System.Environment]::ProcessorCount
|
||||||
$celsius = GetCPUTemperature
|
$celsius = GetCPUTemperature
|
||||||
if ($celsius -eq 99999.9) {
|
if ($celsius -eq 99999.9) {
|
||||||
$temp = "no temp"
|
$temp = ""
|
||||||
|
} elseif ($celsius -gt 80) {
|
||||||
|
$temp = ", $($celsius)°C TOO HOT"
|
||||||
|
$status = "⚠️"
|
||||||
} elseif ($celsius -gt 50) {
|
} elseif ($celsius -gt 50) {
|
||||||
$temp = "$($celsius)°C HOT"
|
$temp = ", $($celsius)°C HOT"
|
||||||
$status = "⚠️"
|
$status = "⚠️"
|
||||||
} elseif ($celsius -lt 0) {
|
} elseif ($celsius -lt 0) {
|
||||||
$temp = "$($celsius)°C COLD"
|
$temp = ", $($celsius)°C TOO COLD"
|
||||||
$status = "⚠️"
|
$status = "⚠️"
|
||||||
|
} elseif ($celsius -lt 30) {
|
||||||
|
$temp = ", $($celsius)°C cool"
|
||||||
} else {
|
} else {
|
||||||
$temp = "$($celsius)°C OK"
|
$temp = ", $($celsius)°C"
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Progress -completed "Done."
|
Write-Progress -completed "Done."
|
||||||
Write-Host "$status $cpuName ($($arch)$cores cores, $($deviceID)$($speed)$($socket)) - $temp"
|
Write-Host "$status $cpuName ($($arch)$cores cores$($temp)$($deviceID)$($speed)$($socket))"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ 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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-credentials.ps1 [[-TargetFile] <String>] [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-credentials.ps1 [[-TargetFile] <String>] [<CommonParameters>]
|
||||||
|
|
||||||
-TargetFile <String>
|
-TargetFile <String>
|
||||||
Specifies the target file ("$HOME\my.credentials" by default)
|
Specifies the target file ("$HOME\my.credentials" by default)
|
||||||
@ -27,7 +27,7 @@ Example
|
|||||||
```powershell
|
```powershell
|
||||||
PS> ./check-credentials.ps1
|
PS> ./check-credentials.ps1
|
||||||
Enter username and password, please.
|
Enter username and password, please.
|
||||||
✔️ Your credentials are correct.
|
✅ Your credentials are correct.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ Script Content
|
|||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-credentials.ps1
|
PS> ./check-credentials.ps1
|
||||||
Enter username and password, please.
|
Enter username and password, please.
|
||||||
✔️ Your credentials are correct.
|
✅ Your credentials are correct.
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -74,7 +74,7 @@ try {
|
|||||||
$pw2 = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($credsFromFile.Password))
|
$pw2 = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($credsFromFile.Password))
|
||||||
if ($pw1 -cne $pw2) { throw "Sorry, your password is wrong." }
|
if ($pw1 -cne $pw2) { throw "Sorry, your password is wrong." }
|
||||||
|
|
||||||
"✔️ Your credentials are correct."
|
"✅ Your credentials are correct."
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ 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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-day.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-day.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-day
|
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).
|
This PowerShell script determines and speaks the current day by text-to-speech (TTS).
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-day
|
PS> ./check-day
|
||||||
✔️ It's Sunday.
|
✅ It's Sunday.
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.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*
|
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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-dns.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-dns.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-dns.ps1
|
PS> ./check-dns.ps1
|
||||||
✅ DNS resolves 56.5 domains per second
|
✅ Internet DNS lookups in 33.6ms
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -36,10 +36,10 @@ Script Content
|
|||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Check the DNS resolution
|
Check the DNS resolution
|
||||||
.DESCRIPTION
|
.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
|
.EXAMPLE
|
||||||
PS> ./check-dns.ps1
|
PS> ./check-dns.ps1
|
||||||
✅ DNS resolves 56.5 domains per second
|
✅ Internet DNS lookups in 33.6ms
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -47,24 +47,21 @@ Script Content
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
#Write-Progress "Measuring DNS resolution..."
|
|
||||||
$table = Import-CSV "$PSScriptRoot/../data/popular-domains.csv"
|
$table = Import-CSV "$PSScriptRoot/../data/popular-domains.csv"
|
||||||
$numRows = $table.Length
|
|
||||||
|
|
||||||
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
foreach($row in $table){$nop=dig $row.Domain +short}
|
foreach($row in $table){$nop=dig $row.Domain +short}
|
||||||
} else {
|
} else {
|
||||||
|
Clear-DnsClientCache
|
||||||
foreach($row in $table){$nop=Resolve-DNSName $row.Domain}
|
foreach($row in $table){$nop=Resolve-DNSName $row.Domain}
|
||||||
}
|
}
|
||||||
[float]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
[float]$elapsed = $stopWatch.Elapsed.TotalSeconds * 1000.0
|
||||||
|
$speed = [math]::round($elapsed / $table.Length, 1)
|
||||||
#Write-Progress -completed "Measuring DNS resolution..."
|
if ($speed -gt 100.0) {
|
||||||
$average = [math]::round($numRows / $elapsed, 1)
|
Write-Host "⚠️ Internet DNS lookups take $($speed)ms!"
|
||||||
if ($average -lt 10.0) {
|
|
||||||
Write-Host "⚠️ DNS resolves $average domains per second only"
|
|
||||||
} else {
|
} else {
|
||||||
Write-Host "✅ DNS resolves $average domains per second"
|
Write-Host "✅ Internet DNS lookups in $($speed)ms"
|
||||||
}
|
}
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} 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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```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>
|
-driveName <String>
|
||||||
Specifies the drive name to check (e.g. "C")
|
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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-drives.ps1 [[-minLevel] <Int64>] [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-drives.ps1 [[-minLevel] <Int64>] [<CommonParameters>]
|
||||||
|
|
||||||
-minLevel <Int64>
|
-minLevel <Int64>
|
||||||
Specifies the minimum warning level (10GB by default)
|
Specifies the minimum warning level (5GB by default)
|
||||||
|
|
||||||
Required? false
|
Required? false
|
||||||
Position? 1
|
Position? 1
|
||||||
Default value 10
|
Default value 5368709120
|
||||||
Accept pipeline input? false
|
Accept pipeline input? false
|
||||||
Accept wildcard characters? false
|
Accept wildcard characters? false
|
||||||
|
|
||||||
@ -26,8 +26,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-drives.ps1
|
PS> ./check-drives.ps1
|
||||||
✅ Drive C: uses 49% of 1TB - 512GB free
|
✅ Drive C: uses 489GB (53%) of 930GB, D: uses 3TB (87%) of 4TB, E: is empty
|
||||||
✅ Drive D: uses 84% of 4TB - 641GB free
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -48,51 +47,54 @@ Script Content
|
|||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script queries the free space of all drives and prints it.
|
This PowerShell script queries the free space of all drives and prints it.
|
||||||
.PARAMETER minLevel
|
.PARAMETER minLevel
|
||||||
Specifies the minimum warning level (10GB by default)
|
Specifies the minimum warning level (5GB by default)
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-drives.ps1
|
PS> ./check-drives.ps1
|
||||||
✅ Drive C: uses 49% of 1TB - 512GB free
|
✅ Drive C: uses 489GB (53%) of 930GB, D: uses 3TB (87%) of 4TB, E: is empty
|
||||||
✅ Drive D: uses 84% of 4TB - 641GB free
|
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz | License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param([int64]$minLevel = 10) # 10 GB minimum
|
param([int64]$minLevel = 5GB)
|
||||||
|
|
||||||
function Bytes2String { param([int64]$number)
|
function Bytes2String { param([int64]$bytes)
|
||||||
if ($number -lt 1KB) { return "$number bytes" }
|
if ($bytes -lt 1KB) { return "$bytes bytes" }
|
||||||
if ($number -lt 1MB) { return '{0:N0}KB' -f ($number / 1KB) }
|
if ($bytes -lt 1MB) { return '{0:N0}KB' -f ($bytes / 1KB) }
|
||||||
if ($number -lt 1GB) { return '{0:N0}MB' -f ($number / 1MB) }
|
if ($bytes -lt 1GB) { return '{0:N0}MB' -f ($bytes / 1MB) }
|
||||||
if ($number -lt 1TB) { return '{0:N0}GB' -f ($number / 1GB) }
|
if ($bytes -lt 1TB) { return '{0:N0}GB' -f ($bytes / 1GB) }
|
||||||
if ($number -lt 1PB) { return '{0:N0}TB' -f ($number / 1TB) }
|
if ($bytes -lt 1PB) { return '{0:N0}TB' -f ($bytes / 1TB) }
|
||||||
return '{0:N0}GB' -f ($number / 1PB)
|
return '{0:N0}GB' -f ($bytes / 1PB)
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Write-Progress "Querying drives..."
|
Write-Progress "Querying drives..."
|
||||||
$drives = Get-PSDrive -PSProvider FileSystem
|
$drives = Get-PSDrive -PSProvider FileSystem
|
||||||
$minLevel *= 1GB
|
Write-Progress -completed "Done."
|
||||||
Write-Progress -completed " "
|
$status = "✅"
|
||||||
|
$reply = "Drive "
|
||||||
foreach($drive in $drives) {
|
foreach($drive in $drives) {
|
||||||
$details = (Get-PSDrive $drive.Name)
|
$details = (Get-PSDrive $drive.Name)
|
||||||
if ($IsLinux) { $name = $drive.Name } else { $name = $drive.Name + ":" }
|
if ($IsLinux) { $name = $drive.Name } else { $name = $drive.Name + ":" }
|
||||||
[int64]$free = $details.Free
|
[int64]$free = $details.Free
|
||||||
[int64]$used = $details.Used
|
[int64]$used = $details.Used
|
||||||
[int64]$total = ($used + $free)
|
[int64]$total = ($used + $free)
|
||||||
|
if ($reply -ne "Drive ") { $reply += ", " }
|
||||||
if ($total -eq 0) {
|
if ($total -eq 0) {
|
||||||
Write-Host "✅ Drive $name is empty"
|
$reply += "$name is empty"
|
||||||
} elseif ($free -eq 0) {
|
} 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) {
|
} 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 {
|
} else {
|
||||||
[int64]$percent = ($used * 100) / $total
|
[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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ 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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-easter-sunday.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-easter-sunday.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-file-system.ps1 [[-Drive] <String>] [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-file-system.ps1 [[-Drive] <String>] [<CommonParameters>]
|
||||||
|
|
||||||
-Drive <String>
|
-Drive <String>
|
||||||
Specifies the drive to check
|
Specifies the drive to check
|
||||||
@ -26,7 +26,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-file-system C
|
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
|
Specifies the drive to check
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-file-system C
|
PS> ./check-file-system C
|
||||||
✔️ file system on drive C is clean
|
✅ file system on drive C is clean
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-file.ps1 [[-Path] <String>] [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-file.ps1 [[-Path] <String>] [<CommonParameters>]
|
||||||
|
|
||||||
-Path <String>
|
-Path <String>
|
||||||
Specifies the path to the file
|
Specifies the path to the file
|
||||||
@ -170,4 +170,4 @@ function Check-Header { param( $path )
|
|||||||
Check-Header $Path
|
Check-Header $Path
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-file.ps1 as of 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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-firewall.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-firewall.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-hardware.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-hardware.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -56,6 +56,7 @@ Write-Host "`n H A R D W A R E" -foregroundColor green
|
|||||||
& "$PSScriptRoot/check-cpu.ps1"
|
& "$PSScriptRoot/check-cpu.ps1"
|
||||||
& "$PSScriptRoot/check-ram.ps1"
|
& "$PSScriptRoot/check-ram.ps1"
|
||||||
& "$PSScriptRoot/check-gpu.ps1"
|
& "$PSScriptRoot/check-gpu.ps1"
|
||||||
|
& "$PSScriptRoot/check-motherboard.ps1"
|
||||||
& "$PSScriptRoot/check-bios.ps1"
|
& "$PSScriptRoot/check-bios.ps1"
|
||||||
& "$PSScriptRoot/check-smart-devices.ps1"
|
& "$PSScriptRoot/check-smart-devices.ps1"
|
||||||
& "$PSScriptRoot/check-power.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
|
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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-health.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-health.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -58,4 +58,4 @@ Script Content
|
|||||||
exit 0 # success
|
exit 0 # success
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-health.ps1 as of 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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-independence-day.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-independence-day.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-ipv4-address.ps1 [[-Address] <String>] [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-ipv4-address.ps1 [[-Address] <String>] [<CommonParameters>]
|
||||||
|
|
||||||
-Address <String>
|
-Address <String>
|
||||||
Specifies the IPv4 address to check
|
Specifies the IPv4 address to check
|
||||||
@ -26,7 +26,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-ipv4-address 192.168.11.22
|
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
|
Specifies the IPv4 address to check
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-ipv4-address 192.168.11.22
|
PS> ./check-ipv4-address 192.168.11.22
|
||||||
✔️ IPv4 192.168.11.22 is valid
|
✅ IPv4 192.168.11.22 is valid
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -72,7 +72,7 @@ try {
|
|||||||
if ($Address -eq "" ) { $Address = read-host "Enter IPv4 address to validate" }
|
if ($Address -eq "" ) { $Address = read-host "Enter IPv4 address to validate" }
|
||||||
|
|
||||||
if (IsIPv4AddressValid $Address) {
|
if (IsIPv4AddressValid $Address) {
|
||||||
"✔️ IPv4 $Address is valid"
|
"✅ IPv4 $Address is valid"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} else {
|
} else {
|
||||||
write-warning "Invalid IPv4 address: $Address"
|
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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-ipv6-address.ps1 [[-Address] <String>] [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-ipv6-address.ps1 [[-Address] <String>] [<CommonParameters>]
|
||||||
|
|
||||||
-Address <String>
|
-Address <String>
|
||||||
Specifies the IPv6 address to check
|
Specifies the IPv6 address to check
|
||||||
@ -26,7 +26,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-ipv6-address fe80::200:5aee:feaa:20a2
|
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
|
Specifies the IPv6 address to check
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-ipv6-address fe80::200:5aee:feaa:20a2
|
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
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -86,7 +86,7 @@ try {
|
|||||||
$Address = read-host "Enter IPv6 address to validate"
|
$Address = read-host "Enter IPv6 address to validate"
|
||||||
}
|
}
|
||||||
if (IsIPv6AddressValid $Address) {
|
if (IsIPv6AddressValid $Address) {
|
||||||
"✔️ IPv6 $Address is valid"
|
"✅ IPv6 $Address is valid"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} else {
|
} else {
|
||||||
write-warning "Invalid IPv6 address: $Address"
|
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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-iss-position.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-iss-position.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-mac-address.ps1 [[-MAC] <String>] [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-mac-address.ps1 [[-MAC] <String>] [<CommonParameters>]
|
||||||
|
|
||||||
-MAC <String>
|
-MAC <String>
|
||||||
Specifies the MAC address to check
|
Specifies the MAC address to check
|
||||||
@ -27,7 +27,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-mac-address 11:22:33:44:55:66
|
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
|
Specifies the MAC address to check
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-mac-address 11:22:33:44:55:66
|
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
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -75,7 +75,7 @@ try {
|
|||||||
$MAC = read-host "Enter MAC address to validate"
|
$MAC = read-host "Enter MAC address to validate"
|
||||||
}
|
}
|
||||||
if (IsMACAddressValid $MAC) {
|
if (IsMACAddressValid $MAC) {
|
||||||
"✔️ MAC address $MAC is valid"
|
"✅ MAC address $MAC is valid"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} else {
|
} else {
|
||||||
write-warning "Invalid MAC address: $MAC"
|
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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-month.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-month.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-month
|
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).
|
This PowerShell script determines and speaks the current month name by text-to-speech (TTS).
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-month
|
PS> ./check-month
|
||||||
✔️ It's December.
|
✅ It's December.
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-moon-phase.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-moon-phase.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-network.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-network.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -21,7 +21,7 @@ PS> ./check-network.ps1
|
|||||||
|
|
||||||
|
|
||||||
N E T W O R K
|
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
|
```powershell
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Checks the network details
|
Checks the network
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script queries the network details of the local computer and prints it.
|
This PowerShell script queries the network details of the local computer and prints it.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-network.ps1
|
PS> ./check-network.ps1
|
||||||
|
|
||||||
N E T W O R K
|
N E T W O R K
|
||||||
✅ Online with 30ms latency (16ms..56ms, 0/10 loss)
|
✅ Firewall enabled
|
||||||
...
|
...
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
@ -55,13 +55,16 @@ Script Content
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
Write-Host "`n N E T W O R K" -foregroundColor green
|
Write-Host "`n N E T W O R K" -foregroundColor green
|
||||||
& "$PSScriptRoot/list-ip-addresses.ps1"
|
|
||||||
& "$PSScriptRoot/ping-remote-hosts.ps1"
|
|
||||||
& "$PSScriptRoot/check-firewall"
|
& "$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/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
|
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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-os.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-os.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-os.ps1
|
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.
|
This PowerShell script queries the operating system status and prints it.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-os.ps1
|
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
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -64,7 +64,7 @@ try {
|
|||||||
$InstallDate = $OSDetails.InstallDate
|
$InstallDate = $OSDetails.InstallDate
|
||||||
|
|
||||||
$ProductKey = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" -Name BackupProductKeyDefault).BackupProductKeyDefault
|
$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
|
exit 0 # success
|
||||||
} catch {
|
} 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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-outlook.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-outlook.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-password.ps1 [[-password] <String>] [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-password.ps1 [[-password] <String>] [<CommonParameters>]
|
||||||
|
|
||||||
-password <String>
|
-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 {
|
try {
|
||||||
$Reason = ""
|
$reply = "✅ No pending reboot"
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
if (Test-Path "/var/run/reboot-required") {
|
if (Test-Path "/var/run/reboot-required") {
|
||||||
$Reason = "found: /var/run/reboot-required"
|
$reply = "⚠️ Pending reboot (found: /var/run/reboot-required)"
|
||||||
Write-Host "⚠️ Pending reboot ($Reason)"
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
$reason = ""
|
||||||
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired") {
|
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") {
|
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") {
|
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") {
|
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") {
|
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") {
|
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") {
|
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") {
|
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") {
|
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") {
|
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 "") {
|
if ($reason -ne "") {
|
||||||
Write-Host "⚠️ Pending reboot (registry got $($Reason.substring(2)))"
|
$reply = "⚠️ Pending reboot (registry got $($reason.substring(2)))"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($Reason -eq "") {
|
Write-Host $reply
|
||||||
Write-Host "✅ No pending reboot"
|
|
||||||
}
|
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ 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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-pnp-devices.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-pnp-devices.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-power.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-power.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-power.ps1
|
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.
|
This PowerShell script queries the power status and prints it.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-power.ps1
|
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
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -54,35 +54,34 @@ try {
|
|||||||
$details = [System.Windows.Forms.SystemInformation]::PowerStatus
|
$details = [System.Windows.Forms.SystemInformation]::PowerStatus
|
||||||
[int]$percent = 100 * $details.BatteryLifePercent
|
[int]$percent = 100 * $details.BatteryLifePercent
|
||||||
[int]$remaining = $details.BatteryLifeRemaining / 60
|
[int]$remaining = $details.BatteryLifeRemaining / 60
|
||||||
|
$powerScheme = (powercfg /getactivescheme)
|
||||||
|
$powerScheme = $powerScheme -Replace "^(.*) \(",""
|
||||||
|
$powerScheme = $powerScheme -Replace "\)$",""
|
||||||
if ($details.PowerLineStatus -eq "Online") {
|
if ($details.PowerLineStatus -eq "Online") {
|
||||||
if ($details.BatteryChargeStatus -eq "NoSystemBattery") {
|
if ($details.BatteryChargeStatus -eq "NoSystemBattery") {
|
||||||
$reply = "✅ AC powered"
|
$reply = "✅ AC powered"
|
||||||
} elseif ($percent -ge 95) {
|
} elseif ($percent -ge 95) {
|
||||||
$reply = "✅ Battery $percent% full"
|
$reply = "✅ Battery nearly full ($percent%, power scheme is '$powerScheme')"
|
||||||
} else {
|
} else {
|
||||||
$reply = "✅ Battery charging ($percent%)"
|
$reply = "✅ Battery $percent% and charging (power scheme is '$powerScheme')"
|
||||||
}
|
}
|
||||||
} else { # must be offline
|
} else { # must be offline
|
||||||
if (($remaining -eq 0) -and ($percent -ge 60)) {
|
if (($remaining -eq 0) -and ($percent -ge 60)) {
|
||||||
$reply = "✅ Battery $percent% full"
|
$reply = "✅ Battery $percent% full (power scheme is '$powerScheme')"
|
||||||
} elseif ($remaining -eq 0) {
|
} elseif ($remaining -eq 0) {
|
||||||
$reply = "✅ Battery at $percent%"
|
$reply = "✅ Battery at $percent% (power scheme is '$powerScheme')"
|
||||||
} elseif ($remaining -le 5) {
|
} 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) {
|
} 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) {
|
} elseif ($percent -lt 10) {
|
||||||
$reply = "⚠️ Battery at $percent% with $($remaining)min remaining"
|
$reply = "⚠️ Battery $percent% only with $($remaining)min remaining (power scheme is '$powerScheme') "
|
||||||
} elseif ($percent -ge 80) {
|
} elseif ($percent -ge 90) {
|
||||||
$reply = "✅ Battery $percent% full with $($remaining)min remaining"
|
$reply = "✅ Battery $percent% full with $($remaining)min remaining (power scheme is '$powerScheme')"
|
||||||
} else {
|
} 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
|
Write-Host $reply
|
||||||
exit 0 # success
|
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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-ps1-file.ps1 [[-filePattern] <String>] [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-ps1-file.ps1 [[-filePattern] <String>] [<CommonParameters>]
|
||||||
|
|
||||||
-filePattern <String>
|
-filePattern <String>
|
||||||
Specifies the file pattern to the PowerShell file(s)
|
Specifies the file pattern to the PowerShell file(s)
|
||||||
@ -26,7 +26,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-ps1-file *.ps1
|
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)
|
Specifies the file pattern to the PowerShell file(s)
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-ps1-file *.ps1
|
PS> ./check-ps1-file *.ps1
|
||||||
✔️ Valid PowerShell in myfile.ps1
|
✅ Valid PowerShell in myfile.ps1
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -67,7 +67,7 @@ try {
|
|||||||
$syntaxError = @()
|
$syntaxError = @()
|
||||||
[void][System.Management.Automation.Language.Parser]::ParseFile($file, [ref]$null, [ref]$syntaxError)
|
[void][System.Management.Automation.Language.Parser]::ParseFile($file, [ref]$null, [ref]$syntaxError)
|
||||||
if ("$syntaxError" -ne "") { throw "$syntaxError" }
|
if ("$syntaxError" -ne "") { throw "$syntaxError" }
|
||||||
"✔️ Valid PowerShell in $($file.Name)"
|
"✅ Valid PowerShell in $($file.Name)"
|
||||||
}
|
}
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} 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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-repo.ps1 [[-pathToRepo] <String>] [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-repo.ps1 [[-pathToRepo] <String>] [<CommonParameters>]
|
||||||
|
|
||||||
-pathToRepo <String>
|
-pathToRepo <String>
|
||||||
Specifies the file path to the local Git repository (current working directory by default)
|
Specifies the file path to the local Git repository (current working directory by default)
|
||||||
@ -121,7 +121,7 @@ try {
|
|||||||
|
|
||||||
$repoDirName = (Get-Item "$FullPath").Name
|
$repoDirName = (Get-Item "$FullPath").Name
|
||||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||||
"✔️ Checked 📂$repoDirName repo in $($elapsed)s."
|
"✅ Checked 📂$repoDirName repo in $($elapsed)s."
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -129,4 +129,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-repo.ps1 as of 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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-repos.ps1 [[-parentDir] <String>] [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-repos.ps1 [[-parentDir] <String>] [<CommonParameters>]
|
||||||
|
|
||||||
-parentDir <String>
|
-parentDir <String>
|
||||||
Specifies the file path to the parent folder
|
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 parent folder 📂C:\Repos... 16 subfolders
|
||||||
⏳ Checking 📂rust repository (1/16)...
|
⏳ 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 parent folder 📂C:\Repos... 16 subfolders
|
||||||
⏳ Checking 📂rust repository (1/16)...
|
⏳ 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
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -83,7 +83,7 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
[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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ 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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-santa.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-santa.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -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.
|
This PowerShell script queries the status of the SSD/HDD devices (supporting S.M.A.R.T.) and prints it.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-smart-devices.ps1
|
PS> ./check-smart-devices.ps1
|
||||||
✅ 1TB Samsung SSD 970 EVO via NVMe (37°C, 2388 hours, 289x on/off, v2B2QEXE7) - selftest OK
|
✅ 1TB Samsung SSD 970 EVO via NVMe (37°C, 2388 hours, 289x on/off, v2B2QEXE7, test passed)
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -82,7 +82,10 @@ try {
|
|||||||
$capacity = ""
|
$capacity = ""
|
||||||
}
|
}
|
||||||
if ($details.temperature.current -gt 50) {
|
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 = "⚠️"
|
$status = "⚠️"
|
||||||
} else {
|
} else {
|
||||||
$temp = "$($details.temperature.current)°C"
|
$temp = "$($details.temperature.current)°C"
|
||||||
@ -100,13 +103,13 @@ try {
|
|||||||
$powerOn = "$($details.power_cycle_count)x on/off"
|
$powerOn = "$($details.power_cycle_count)x on/off"
|
||||||
}
|
}
|
||||||
if ($details.smart_status.passed) {
|
if ($details.smart_status.passed) {
|
||||||
$selftest = "selftest OK"
|
$selftest = "test passed"
|
||||||
} else {
|
} else {
|
||||||
$selftest = "selftest FAILED"
|
$selftest = "test FAILED"
|
||||||
$status = "⚠️"
|
$status = "⚠️"
|
||||||
}
|
}
|
||||||
$firmwareVersion = $details.firmware_version
|
$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."
|
#Write-Progress -completed "Done."
|
||||||
exit 0 # success
|
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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-software.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-software.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -61,8 +61,7 @@ Write-Host "`n S O F T W A R E" -foregroundColor green
|
|||||||
& "$PSScriptRoot/check-powershell.ps1"
|
& "$PSScriptRoot/check-powershell.ps1"
|
||||||
& "$PSScriptRoot/check-time-zone.ps1"
|
& "$PSScriptRoot/check-time-zone.ps1"
|
||||||
& "$PSScriptRoot/check-swap-space.ps1"
|
& "$PSScriptRoot/check-swap-space.ps1"
|
||||||
& "$PSScriptRoot/check-pending-reboot.ps1"
|
|
||||||
exit 0 # success
|
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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-subnet-mask.ps1 [[-address] <String>] [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-subnet-mask.ps1 [[-address] <String>] [<CommonParameters>]
|
||||||
|
|
||||||
-address <String>
|
-address <String>
|
||||||
Specifies the subnet mask to check
|
Specifies the subnet mask to check
|
||||||
@ -26,7 +26,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-subnet-mask.ps1 255.255.255.0
|
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
|
Specifies the subnet mask to check
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-subnet-mask.ps1 255.255.255.0
|
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
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -72,7 +72,7 @@ try {
|
|||||||
if ($address -eq "" ) { $address = read-host "Enter subnet mask to validate" }
|
if ($address -eq "" ) { $address = read-host "Enter subnet mask to validate" }
|
||||||
|
|
||||||
if (IsSubNetMaskValid $address) {
|
if (IsSubNetMaskValid $address) {
|
||||||
"✔️ subnet mask $Address is valid"
|
"✅ subnet mask $Address is valid"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} else {
|
} else {
|
||||||
write-warning "Invalid subnet mask: $address"
|
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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-swap-space.ps1 [[-minLevel] <Int32>] [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-swap-space.ps1 [[-minLevel] <Int32>] [<CommonParameters>]
|
||||||
|
|
||||||
-minLevel <Int32>
|
-minLevel <Int32>
|
||||||
Specifies the minimum level in MB (10 MB by default)
|
Specifies the minimum level in MB (10 MB by default)
|
||||||
@ -26,7 +26,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-swap-space.ps1
|
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)
|
Specifies the minimum level in MB (10 MB by default)
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-swap-space.ps1
|
PS> ./check-swap-space.ps1
|
||||||
✅ Swap space uses 21% of 1GB - 1005MB free
|
✅ Swap space uses 1GB (21%) of 5GB
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -91,14 +91,14 @@ try {
|
|||||||
if ($total -eq 0) {
|
if ($total -eq 0) {
|
||||||
Write-Output "⚠️ No swap space configured"
|
Write-Output "⚠️ No swap space configured"
|
||||||
} elseif ($free -eq 0) {
|
} 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) {
|
} 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) {
|
} elseif ($used -lt 3) {
|
||||||
Write-Output "✅ Swap space unused - full $(MB2String $free) free"
|
Write-Output "✅ Swap space has $(MB2String $total) reserved"
|
||||||
} else {
|
} else {
|
||||||
[int64]$percent = ($used * 100) / $total
|
[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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
@ -107,4 +107,4 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-swap-space.ps1 as of 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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-symlinks.ps1 [[-Folder] <String>] [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-symlinks.ps1 [[-Folder] <String>] [<CommonParameters>]
|
||||||
|
|
||||||
-Folder <String>
|
-Folder <String>
|
||||||
Specifies the path to the folder
|
Specifies the path to the folder
|
||||||
@ -28,7 +28,7 @@ Example
|
|||||||
```powershell
|
```powershell
|
||||||
PS> ./check-symlinks C:\Users
|
PS> ./check-symlinks C:\Users
|
||||||
⏳ Checking symlinks at 📂C:\Users including subfolders...
|
⏳ 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
|
.EXAMPLE
|
||||||
PS> ./check-symlinks C:\Users
|
PS> ./check-symlinks C:\Users
|
||||||
⏳ Checking symlinks at 📂C:\Users including subfolders...
|
⏳ 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
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -87,11 +87,11 @@ try {
|
|||||||
|
|
||||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||||
if ($NumTotal -eq 0) {
|
if ($NumTotal -eq 0) {
|
||||||
"✔️ No symlink found at 📂$FullPath in $Elapsed sec"
|
"✅ No symlink found at 📂$FullPath in $Elapsed sec"
|
||||||
} elseif ($NumBroken -eq 1) {
|
} elseif ($NumBroken -eq 1) {
|
||||||
"✔️ Found $NumBroken broken symlink at 📂$FullPath in $Elapsed sec"
|
"✅ Found $NumBroken broken symlink at 📂$FullPath in $Elapsed sec"
|
||||||
} else {
|
} else {
|
||||||
"✔️ Found $NumBroken broken symlinks at 📂$FullPath in $Elapsed sec"
|
"✅ Found $NumBroken broken symlinks at 📂$FullPath in $Elapsed sec"
|
||||||
}
|
}
|
||||||
exit $NumBroken
|
exit $NumBroken
|
||||||
} catch {
|
} 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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-time-zone.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-time-zone.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-time-zone.ps1
|
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.
|
This PowerShell script queries the local time zone and prints it.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-time-zone.ps1
|
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
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -58,7 +58,7 @@ try {
|
|||||||
$TZName = $TZ.StandardName
|
$TZName = $TZ.StandardName
|
||||||
$DST=""
|
$DST=""
|
||||||
}
|
}
|
||||||
Write-Host "✅ $Time in $TZName (UTC+$($offset)$($DST))"
|
Write-Host "✅ $Time $TZName (UTC+$($offset)$($DST))"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -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 {
|
try {
|
||||||
[system.threading.thread]::currentthread.currentculture = [system.globalization.cultureinfo]"en-US"
|
[system.threading.thread]::currentthread.currentculture = [system.globalization.cultureinfo]"en-US"
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
@ -53,7 +62,51 @@ try {
|
|||||||
$lastBootTime = (Get-CimInstance Win32_OperatingSystem).LastBootUpTime
|
$lastBootTime = (Get-CimInstance Win32_OperatingSystem).LastBootUpTime
|
||||||
$uptime = New-TimeSpan -Start $lastBootTime -End (Get-Date)
|
$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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ 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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-vpn.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-vpn.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-weather.ps1 [[-location] <String>] [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-weather.ps1 [[-location] <String>] [<CommonParameters>]
|
||||||
|
|
||||||
-location <String>
|
-location <String>
|
||||||
Specifies the location to use (determined automatically per default)
|
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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-week.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-week.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-wind.ps1 [[-location] <String>] [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-wind.ps1 [[-location] <String>] [<CommonParameters>]
|
||||||
|
|
||||||
-location <String>
|
-location <String>
|
||||||
Specifies the location to use (determined automatically per default)
|
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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-windows-system-files.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-windows-system-files.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-windows-system-files.ps1
|
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.
|
This PowerShell script checks the validity of the Windows system files. It requires admin rights.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-windows-system-files.ps1
|
PS> ./check-windows-system-files.ps1
|
||||||
✔️ checked Windows system files
|
✅ checked Windows system files
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -52,7 +52,7 @@ try {
|
|||||||
sfc /verifyOnly
|
sfc /verifyOnly
|
||||||
if ($lastExitCode -ne "0") { throw "'sfc /verifyOnly' failed" }
|
if ($lastExitCode -ne "0") { throw "'sfc /verifyOnly' failed" }
|
||||||
|
|
||||||
"✔️ checked Windows system files"
|
"✅ checked Windows system files"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ 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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-xml-file.ps1 [[-path] <String>] [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-xml-file.ps1 [[-path] <String>] [<CommonParameters>]
|
||||||
|
|
||||||
-path <String>
|
-path <String>
|
||||||
Specifies the path to the XML file
|
Specifies the path to the XML file
|
||||||
@ -26,7 +26,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-xml-file.ps1 myfile.xml
|
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
|
Specifies the path to the XML file
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-xml-file.ps1 myfile.xml
|
PS> ./check-xml-file.ps1 myfile.xml
|
||||||
✔️ Valid XML in 📄myfile.xml
|
✅ Valid XML in 📄myfile.xml
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -77,7 +77,7 @@ try {
|
|||||||
|
|
||||||
if ($script:ErrorCount -gt 0) { throw "Invalid XML" }
|
if ($script:ErrorCount -gt 0) { throw "Invalid XML" }
|
||||||
|
|
||||||
"✔️ Valid XML in 📄$path"
|
"✅ Valid XML in 📄$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ $($Error[0]) in 📄$path"
|
"⚠️ $($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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./check-xml-files.ps1 [[-path] <String>] [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/check-xml-files.ps1 [[-path] <String>] [<CommonParameters>]
|
||||||
|
|
||||||
-path <String>
|
-path <String>
|
||||||
Specifies the path to the directory tree (current working dir by default)
|
Specifies the path to the directory tree (current working dir by default)
|
||||||
@ -27,7 +27,7 @@ Example
|
|||||||
```powershell
|
```powershell
|
||||||
PS> ./check-xml-files.ps1 C:\Windows
|
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
|
.EXAMPLE
|
||||||
PS> ./check-xml-files.ps1 C:\Windows
|
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
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -75,7 +75,7 @@ try {
|
|||||||
|
|
||||||
[int]$total = $valid + $invalid
|
[int]$total = $valid + $invalid
|
||||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
[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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ 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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./clean-repo.ps1 [[-path] <String>] [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/clean-repo.ps1 [[-path] <String>] [<CommonParameters>]
|
||||||
|
|
||||||
-path <String>
|
-path <String>
|
||||||
Specifies the file path to the local Git repository (current working directory by default)
|
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
|
⏳ (2/4) Checking local repository... C:\Repos\rust
|
||||||
⏳ (3/4) Removing untracked files in repository...
|
⏳ (3/4) Removing untracked files in repository...
|
||||||
⏳ (4/4) Removing untracked files in submodules...
|
⏳ (4/4) Removing untracked files in submodules...
|
||||||
✔️ 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
|
⏳ (2/4) Checking local repository... C:\Repos\rust
|
||||||
⏳ (3/4) Removing untracked files in repository...
|
⏳ (3/4) Removing untracked files in repository...
|
||||||
⏳ (4/4) Removing untracked files in submodules...
|
⏳ (4/4) Removing untracked files in submodules...
|
||||||
✔️ Cleaned up 📂rust repository in 2s.
|
✅ Cleaned up 📂rust repo in 2s.
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -93,7 +93,7 @@ try {
|
|||||||
if ($lastExitCode -ne "0") { throw "'git clean' in the submodules failed with exit code $lastExitCode" }
|
if ($lastExitCode -ne "0") { throw "'git clean' in the submodules failed with exit code $lastExitCode" }
|
||||||
|
|
||||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||||
"✔️ Cleaned up 📂$repoName repository in $($elapsed)s."
|
"✅ Cleaned up 📂$repoName repo in $($elapsed)s."
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./clean-repos.ps1 [[-parentDir] <String>] [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/clean-repos.ps1 [[-parentDir] <String>] [<CommonParameters>]
|
||||||
|
|
||||||
-parentDir <String>
|
-parentDir <String>
|
||||||
Specifies the path to the parent folder (current working dir by default)
|
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" }
|
if ($lastExitCode -ne "0") { throw "'git clean -xfd -f' in submodules failed with exit code $lastExitCode" }
|
||||||
}
|
}
|
||||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
[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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ 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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./clear-dns-cache.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/clear-dns-cache.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -17,7 +17,7 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./clear-dns-cache.ps1
|
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.
|
This PowerShell script clears the DNS client cache of the local computer.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./clear-dns-cache.ps1
|
PS> ./clear-dns-cache.ps1
|
||||||
✔️ Cleared DNS cache in 1 sec
|
✅ Cleared DNS cache in 1s.
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -47,12 +47,12 @@ Script Content
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||||
|
|
||||||
Clear-DnsClientCache
|
Clear-DnsClientCache
|
||||||
|
|
||||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||||
"✔️ Cleared DNS cache in $Elapsed sec"
|
"✅ Cleared DNS cache in $($elapsed)s."
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./clear-recycle-bin.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/clear-recycle-bin.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./clone-repos.ps1 [[-targetDir] <String>] [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/clone-repos.ps1 [[-targetDir] <String>] [<CommonParameters>]
|
||||||
|
|
||||||
-targetDir <String>
|
-targetDir <String>
|
||||||
Specifies the file path to the target directory (current working directory by default)
|
Specifies the file path to the target directory (current working directory by default)
|
||||||
@ -26,8 +26,11 @@ Example
|
|||||||
-------
|
-------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./clone-repos C:\MyRepos
|
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)
|
Specifies the file path to the target directory (current working directory by default)
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./clone-repos C:\MyRepos
|
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
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -89,22 +95,22 @@ try {
|
|||||||
$step++
|
$step++
|
||||||
|
|
||||||
if (Test-Path "$targetDir/$folderName" -pathType container) {
|
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++
|
$skipped++
|
||||||
} elseif ($shallow -eq "yes") {
|
} 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"
|
& git clone --branch "$branch" --single-branch --recurse-submodules "$URL" "$targetDir/$folderName"
|
||||||
if ($lastExitCode -ne "0") { throw "'git clone --branch $branch $URL' failed with exit code $lastExitCode" }
|
if ($lastExitCode -ne "0") { throw "'git clone --branch $branch $URL' failed with exit code $lastExitCode" }
|
||||||
$cloned++
|
$cloned++
|
||||||
} else {
|
} else {
|
||||||
"⏳ ($step/$($total + 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"
|
& git clone --branch "$branch" --recurse-submodules "$URL" "$targetDir/$folderName"
|
||||||
if ($lastExitCode -ne "0") { throw "'git clone --branch $branch $URL' failed with exit code $lastExitCode" }
|
if ($lastExitCode -ne "0") { throw "'git clone --branch $branch $URL' failed with exit code $lastExitCode" }
|
||||||
$clone++
|
$clone++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||||
"✔️ Cloned $cloned additional Git repos into 📂$targetDirName in $($elapsed)s."
|
"✅ Cloned $cloned additional Git repos into 📂$targetDirName in $($elapsed)s."
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
@ -112,4 +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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./clone-shallow.ps1 [[-targetDir] <String>] [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/clone-shallow.ps1 [[-targetDir] <String>] [<CommonParameters>]
|
||||||
|
|
||||||
-targetDir <String>
|
-targetDir <String>
|
||||||
Specifies the file path to the target directory (current working directory by default)
|
Specifies the file path to the target directory (current working directory by default)
|
||||||
@ -66,7 +66,7 @@ try {
|
|||||||
|
|
||||||
|
|
||||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||||
"✔️ Cloned the shallow repository in $elapsed sec"
|
"✅ Cloned the shallow repository in $elapsed sec"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ 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
|
Parameters
|
||||||
----------
|
----------
|
||||||
```powershell
|
```powershell
|
||||||
PS> ./close-calculator.ps1 [<CommonParameters>]
|
/home/markus/Repos/PowerShell/scripts/close-calculator.ps1 [<CommonParameters>]
|
||||||
|
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||||
@ -48,4 +48,4 @@ Stop-Process -name "CalculatorApp"
|
|||||||
exit 0 # success
|
exit 0 # success
|
||||||
```
|
```
|
||||||
|
|
||||||
*(generated by convert-ps2md.ps1 using the comment-based help of close-calculator.ps1 as of 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