mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-28 10:53:32 +01:00
Update the manuals
This commit is contained in:
parent
fdaa75ddfd
commit
6df3796258
@ -1,4 +1,4 @@
|
||||
## The *add-firewall-rules.ps1* PowerShell Script
|
||||
## The *add-firewall-rules.ps1* Script
|
||||
|
||||
This PowerShell script adds firewall rules for the given executable. Administrator rights are required.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *add-memo.ps1* PowerShell Script
|
||||
## The *add-memo.ps1* Script
|
||||
|
||||
This PowerShell script adds the given memo text to $HOME/Memos.csv.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *alert.ps1* PowerShell Script
|
||||
## The *alert.ps1* Script
|
||||
|
||||
This PowerShell script handles and escalates the given alert message.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *build-repo.ps1* PowerShell Script
|
||||
## The *build-repo.ps1* Script
|
||||
|
||||
This PowerShell script supports building with cmake, configure, autogen, Imakefile and Makefile.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *build-repos.ps1* PowerShell Script
|
||||
## The *build-repos.ps1* Script
|
||||
|
||||
This PowerShell script builds all Git repositories in a folder.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *cd-autostart.ps1* PowerShell Script
|
||||
## The *cd-autostart.ps1* Script
|
||||
|
||||
This PowerShell script changes the working directory to the user's autostart folder.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *cd-desktop.ps1* PowerShell Script
|
||||
## The *cd-desktop.ps1* Script
|
||||
|
||||
This PowerShell script changes the working directory to the user's desktop folder.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *cd-docs.ps1* PowerShell Script
|
||||
## The *cd-docs.ps1* Script
|
||||
|
||||
This PowerShell script changes the working directory to the documents folder.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *cd-downloads.ps1* PowerShell Script
|
||||
## The *cd-downloads.ps1* Script
|
||||
|
||||
This PowerShell script changes the working directory to the user's downloads folder.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *cd-dropbox.ps1* PowerShell Script
|
||||
## The *cd-dropbox.ps1* Script
|
||||
|
||||
This PowerShell script changes the working directory to the user's Dropbox folder.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *cd-fonts.ps1* PowerShell Script
|
||||
## The *cd-fonts.ps1* Script
|
||||
|
||||
This PowerShell script changes the working directory to the fonts folder.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *cd-home.ps1* PowerShell Script
|
||||
## The *cd-home.ps1* Script
|
||||
|
||||
This PowerShell script changes the working directory to the user's home directory.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *cd-music.ps1* PowerShell Script
|
||||
## The *cd-music.ps1* Script
|
||||
|
||||
This PowerShell script changes the working directory to the user's music folder.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *cd-onedrive.ps1* PowerShell Script
|
||||
## The *cd-onedrive.ps1* Script
|
||||
|
||||
This PowerShell script changes the working directory to the user's OneDrive folder.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *cd-pics.ps1* PowerShell Script
|
||||
## The *cd-pics.ps1* Script
|
||||
|
||||
This PowerShell script changes the working directory to the user's pictures folder.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *cd-recycle-bin.ps1* PowerShell Script
|
||||
## The *cd-recycle-bin.ps1* Script
|
||||
|
||||
cd-recycle-bin.ps1
|
||||
|
||||
|
@ -1,10 +1,19 @@
|
||||
## The *cd-repos.ps1* PowerShell Script
|
||||
## The *cd-repos.ps1* Script
|
||||
|
||||
This PowerShell script changes the working directory to the user's Git repositories folder.
|
||||
|
||||
## Parameters
|
||||
```powershell
|
||||
cd-repos.ps1 [<CommonParameters>]
|
||||
cd-repos.ps1 [[-Subpath] <String>] [<CommonParameters>]
|
||||
|
||||
-Subpath <String>
|
||||
Specifies an additional relative subpath (optional)
|
||||
|
||||
Required? false
|
||||
Position? 1
|
||||
Default value
|
||||
Accept pipeline input? false
|
||||
Accept wildcard characters? false
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
@ -31,6 +40,8 @@ https://github.com/fleschutz/PowerShell
|
||||
Sets the working directory to the user's repos folder
|
||||
.DESCRIPTION
|
||||
This PowerShell script changes the working directory to the user's Git repositories folder.
|
||||
.PARAMETER Subpath
|
||||
Specifies an additional relative subpath (optional)
|
||||
.EXAMPLE
|
||||
PS> ./cd-repos
|
||||
📂C:\Users\Markus\Repos
|
||||
@ -40,22 +51,27 @@ https://github.com/fleschutz/PowerShell
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
param([string]$Subpath = "")
|
||||
|
||||
try {
|
||||
if (Test-Path "$HOME/Repos" -pathType Container) {
|
||||
$Path = Resolve-Path "$HOME/Repos" # short form
|
||||
} elseif (Test-Path "$HOME/Repositories" -pathType Container) {
|
||||
$Path = Resolve-Path "$HOME/Repositories" # long form
|
||||
} elseif (Test-Path "$HOME/source/repos" -pathType Container) {
|
||||
$Path = Resolve-Path "$HOME/source/repos" # default by Visual Studio
|
||||
if (Test-Path "$HOME/Repos" -pathType Container) { # try short name
|
||||
$Path = "$HOME/Repos/$Subpath"
|
||||
} elseif (Test-Path "$HOME/Repositories" -pathType Container) { # try long name
|
||||
$Path = "$HOME/Repositories/$Subpath"
|
||||
} elseif (Test-Path "$HOME/source/repos" -pathType Container) { # try Visual Studio default
|
||||
$Path = "$HOME/source/repos/$Subpath"
|
||||
} else {
|
||||
$Path = "$HOME/Repos"
|
||||
throw "Folder for Git repositories at 📂$Path doesn't exist (yet)"
|
||||
throw "The folder for Git repositories at 📂$HOME/Reposh doesn't exist (yet)."
|
||||
}
|
||||
if (-not(Test-Path "$Path" -pathType Container)) {
|
||||
throw "The path to 📂$Path doesn't exist (yet)."
|
||||
}
|
||||
$Path = Resolve-Path "$Path"
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
"⚠️ Error: $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
```
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *cd-root.ps1* PowerShell Script
|
||||
## The *cd-root.ps1* Script
|
||||
|
||||
This PowerShell script changes the current working directory to the root directory (C:\ on Windows).
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *cd-screenshots.ps1* PowerShell Script
|
||||
## The *cd-screenshots.ps1* Script
|
||||
|
||||
This PowerShell script changes the working directory to the user's screenshots folder.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *cd-scripts.ps1* PowerShell Script
|
||||
## The *cd-scripts.ps1* Script
|
||||
|
||||
This PowerShell script changes the working directory to the PowerShell scripts folder.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *cd-ssh.ps1* PowerShell Script
|
||||
## The *cd-ssh.ps1* Script
|
||||
|
||||
This PowerShell script changes the working directory to the user's SSH folder.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *cd-temp.ps1* PowerShell Script
|
||||
## The *cd-temp.ps1* Script
|
||||
|
||||
cd-temp.ps1
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *cd-up.ps1* PowerShell Script
|
||||
## The *cd-up.ps1* Script
|
||||
|
||||
This PowerShell script changes the working directory to one directory level up.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *cd-up2.ps1* PowerShell Script
|
||||
## The *cd-up2.ps1* Script
|
||||
|
||||
This PowerShell script changes the working directory to two directory level up.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *cd-up3.ps1* PowerShell Script
|
||||
## The *cd-up3.ps1* Script
|
||||
|
||||
This PowerShell script changes the working directory to three directory levels up.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *cd-up4.ps1* PowerShell Script
|
||||
## The *cd-up4.ps1* Script
|
||||
|
||||
This PowerShell script changes the working directory to four directory levels up.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *cd-users.ps1* PowerShell Script
|
||||
## The *cd-users.ps1* Script
|
||||
|
||||
This PowerShell script changes the working directory to the users directory.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *cd-videos.ps1* PowerShell Script
|
||||
## The *cd-videos.ps1* Script
|
||||
|
||||
This PowerShell script changes the working directory to the user's videos folder.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *cd-windows.ps1* PowerShell Script
|
||||
## The *cd-windows.ps1* Script
|
||||
|
||||
This PowerShell script changes the working directory to the Windows directory.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *change-wallpaper.ps1* PowerShell Script
|
||||
## The *change-wallpaper.ps1* Script
|
||||
|
||||
This PowerShell script downloads a random photo from Unsplash and sets it as desktop background.
|
||||
|
||||
|
57
Docs/check-apps.md
Normal file
57
Docs/check-apps.md
Normal file
@ -0,0 +1,57 @@
|
||||
## The *check-apps.ps1* Script
|
||||
|
||||
This PowerShell script queries application details and list it.
|
||||
|
||||
## Parameters
|
||||
```powershell
|
||||
check-apps.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
|
||||
```
|
||||
|
||||
## Example
|
||||
```powershell
|
||||
PS> ./check-apps
|
||||
|
||||
```
|
||||
|
||||
## Notes
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
|
||||
## Related Links
|
||||
https://github.com/fleschutz/PowerShell
|
||||
|
||||
## Source Code
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Query application details
|
||||
.DESCRIPTION
|
||||
This PowerShell script queries application details and list it.
|
||||
.EXAMPLE
|
||||
PS> ./check-apps
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
if ($IsLinux) {
|
||||
# TODO
|
||||
} else {
|
||||
Write-Progress "Querying installed apps and available updates..."
|
||||
$NumAppsInstalled = (Get-AppxPackage).Count
|
||||
$NumUpdates = (winget upgrade).Count - 5
|
||||
"✅ $NumAppsInstalled apps installed, $NumUpdates updates available"
|
||||
}
|
||||
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-apps.ps1*
|
67
Docs/check-battery.md
Normal file
67
Docs/check-battery.md
Normal file
@ -0,0 +1,67 @@
|
||||
## The *check-battery.ps1* Script
|
||||
|
||||
This PowerShell script checks and prints the battery status.
|
||||
|
||||
## Parameters
|
||||
```powershell
|
||||
check-battery.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
|
||||
```
|
||||
|
||||
## Example
|
||||
```powershell
|
||||
PS> ./check-battery
|
||||
|
||||
```
|
||||
|
||||
## Notes
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
|
||||
## Related Links
|
||||
https://github.com/fleschutz/PowerShell
|
||||
|
||||
## Source Code
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checks the battery status
|
||||
.DESCRIPTION
|
||||
This PowerShell script checks and prints the battery status.
|
||||
.EXAMPLE
|
||||
PS> ./check-battery
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
if ($IsLinux) {
|
||||
# TODO
|
||||
} else {
|
||||
Add-Type -Assembly System.Windows.Forms
|
||||
$Details = [System.Windows.Forms.SystemInformation]::PowerStatus
|
||||
if ($Details.BatteryChargeStatus -eq "NoSystemBattery") {
|
||||
$BatteryStatus = "No battery"
|
||||
} else {
|
||||
[int]$Percent = 100*$Details.BatteryLifePercent
|
||||
[int]$Remaining = $Details.BatteryLifeRemaining / 60
|
||||
$BatteryStatus = "Battery $Percent%, $Remaining min left"
|
||||
}
|
||||
switch ($Details.PowerLineStatus) {
|
||||
"Online" { $PowerStatus = "plugged in to AC power" }
|
||||
"Offline" { $PowerStatus = "disconnected from AC power" }
|
||||
}
|
||||
"✅ $BatteryStatus, $PowerStatus"
|
||||
}
|
||||
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-battery.ps1*
|
@ -1,4 +1,4 @@
|
||||
## The *check-bios.ps1* PowerShell Script
|
||||
## The *check-bios.ps1* Script
|
||||
|
||||
This PowerShell script queries BIOS details and prints it.
|
||||
|
||||
@ -14,6 +14,7 @@ check-bios.ps1 [<CommonParameters>]
|
||||
## Example
|
||||
```powershell
|
||||
PS> ./check-bios
|
||||
✅ BIOS V1.10 by INSYDE Corp. (S/N NXA82EV0EBB07600, version ACRSYS - 2)
|
||||
|
||||
```
|
||||
|
||||
@ -32,6 +33,7 @@ https://github.com/fleschutz/PowerShell
|
||||
This PowerShell script queries BIOS details and prints it.
|
||||
.EXAMPLE
|
||||
PS> ./check-bios
|
||||
✅ BIOS V1.10 by INSYDE Corp. (S/N NXA82EV0EBB07600, version ACRSYS - 2)
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -39,15 +41,16 @@ https://github.com/fleschutz/PowerShell
|
||||
#>
|
||||
|
||||
try {
|
||||
Write-Progress "Querying BIOS details..."
|
||||
if ($IsLinux) {
|
||||
# TODO
|
||||
} else {
|
||||
$BIOS = Get-CimInstance -ClassName Win32_BIOS
|
||||
$Manufacturer = $BIOS.Manufacturer
|
||||
$Model = $BIOS.Name
|
||||
$SerialNumber = $BIOS.SerialNumber
|
||||
$Serial = $BIOS.SerialNumber
|
||||
$Version = $BIOS.Version
|
||||
"✅ $Manufacturer BIOS $($Model): S/N $SerialNumber, version $Version"
|
||||
"✅ BIOS $Model by $Manufacturer (S/N $Serial, version $Version)"
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-cpu.ps1* PowerShell Script
|
||||
## The *check-cpu.ps1* Script
|
||||
|
||||
check-cpu.ps1
|
||||
|
||||
@ -16,12 +16,12 @@ check-cpu.ps1
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checks the CPU temperature
|
||||
Queries and prints CPU details
|
||||
.DESCRIPTION
|
||||
This PowerShell script queries the CPU temperature and returns it.
|
||||
This PowerShell script queries CPU details (name, type, speed, temperature, etc.) and prints it.
|
||||
.EXAMPLE
|
||||
PS> ./check-cpu
|
||||
CPU is 30.3°C warm.
|
||||
✅ CPU AMD Ryzen 5 5500U with Radeon Graphics (CPU0, 2100MHz, 31.3°C)
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -46,23 +46,27 @@ function GetCPUTemperatureInCelsius {
|
||||
}
|
||||
|
||||
try {
|
||||
Write-Progress "Querying CPU details ..."
|
||||
$Celsius = GetCPUTemperatureInCelsius
|
||||
if ($Celsius -eq 99999.9) {
|
||||
$Temp = "no temp"
|
||||
} elseif ($Celsius -gt 50) {
|
||||
$Temp = "$($Celsius)°C hot"
|
||||
} elseif ($Celsius -gt 0) {
|
||||
$Temp = "$($Celsius)°C warm"
|
||||
$Temp = "⚠️$($Celsius)°C"
|
||||
} elseif ($Celsius -lt 0) {
|
||||
$Temp = "⚠️$($Celsius)°C"
|
||||
} else {
|
||||
$Temp = "$($Celsius)°C cold"
|
||||
$Temp = "$($Celsius)°C"
|
||||
}
|
||||
|
||||
if ($IsLinux) {
|
||||
"✅ CPU is $Temp."
|
||||
"✅ CPU has $Temp"
|
||||
} else {
|
||||
$Details = Get-WmiObject -Class Win32_Processor
|
||||
$DeviceName = $Details.Name.trim()
|
||||
"✅ $($DeviceName): $($Details.DeviceID), $($Details.MaxClockSpeed)MHz, $Temp"
|
||||
$CPUName = $Details.Name.trim()
|
||||
$DeviceID = $Details.DeviceID
|
||||
$Speed = "$($Details.MaxClockSpeed)MHz"
|
||||
$Socket = $Details.SocketDesignation
|
||||
"✅ CPU $CPUName ($DeviceID, $Speed, socket $Socket, $Temp)"
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-day.ps1* PowerShell Script
|
||||
## The *check-day.ps1* Script
|
||||
|
||||
This PowerShell script determines and speaks the current day by text-to-speech (TTS).
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-dns-server.ps1* PowerShell Script
|
||||
## The *check-dns-server.ps1* Script
|
||||
|
||||
check-dns-server.ps1
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-dns.ps1* PowerShell Script
|
||||
## The *check-dns.ps1* Script
|
||||
|
||||
This PowerShell script measures and prints the DNS resolution speed by using 200 frequently used domain names.
|
||||
|
||||
@ -55,7 +55,7 @@ try {
|
||||
$Average = [math]::round($NumRows / $Elapsed, 1)
|
||||
|
||||
if ($Average -gt 10.0) {
|
||||
"✅ DNS resolves $Average domains per second."
|
||||
"✅ DNS resolves $Average domains per second"
|
||||
} else {
|
||||
"⚠️ DNS resolves only $Average domains per second!"
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-drive-space.ps1* PowerShell Script
|
||||
## The *check-drive-space.ps1* Script
|
||||
|
||||
This PowerShell script checks a drive for free space left (20 GB by default).
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-drives.ps1* PowerShell Script
|
||||
## The *check-drives.ps1* Script
|
||||
|
||||
This PowerShell script checks all drives for free space left.
|
||||
|
||||
@ -77,13 +77,13 @@ try {
|
||||
[int64]$Total = ($Used + $Free)
|
||||
|
||||
if ($Total -eq 0) {
|
||||
"✅ Drive $ID is empty."
|
||||
"✅ Drive $ID is empty"
|
||||
} elseif ($Free -lt $MinLevel) {
|
||||
"⚠️ Drive $ID has only $(Bytes2String $Free) of $(Bytes2String $Total) left to use!"
|
||||
} elseif ($Used -lt $Free) {
|
||||
"✅ Drive $ID uses $(Bytes2String $Used) of $(Bytes2String $Total)."
|
||||
"✅ Drive $ID uses $(Bytes2String $Used) of $(Bytes2String $Total)"
|
||||
} else {
|
||||
"✅ Drive $ID has $(Bytes2String $Free) of $(Bytes2String $Total) left."
|
||||
"✅ Drive $ID has $(Bytes2String $Free) free of $(Bytes2String $Total)"
|
||||
}
|
||||
}
|
||||
exit 0 # success
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-dusk.ps1* PowerShell Script
|
||||
## The *check-dusk.ps1* Script
|
||||
|
||||
check-dusk.ps1
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-easter-sunday.ps1* PowerShell Script
|
||||
## The *check-easter-sunday.ps1* Script
|
||||
|
||||
This PowerShell script checks the time until Easter Sunday and replies by text-to-speech (TTS).
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-file-system.ps1* PowerShell Script
|
||||
## The *check-file-system.ps1* Script
|
||||
|
||||
This PowerShell script checks the file system of a drive. It needs admin rights.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-gpu.ps1* PowerShell Script
|
||||
## The *check-gpu.ps1* Script
|
||||
|
||||
check-gpu.ps1
|
||||
|
||||
@ -52,7 +52,7 @@ try {
|
||||
$RefreshRate = $Details.CurrentRefreshRate
|
||||
$DriverVersion = $Details.DriverVersion
|
||||
$Status = $Details.Status
|
||||
"✅ $($Model): $(Bytes2String $RAMSize) RAM, $($ResWidth)x$($ResHeight) pixels, $BitsPerPixel bit, $RefreshRate Hz, driver $DriverVersion, status $Status"
|
||||
"✅ GPU $($Model) ($(Bytes2String $RAMSize) RAM, $($ResWidth)x$($ResHeight) pixels, $BitsPerPixel bit, $RefreshRate Hz, driver $DriverVersion, status $Status)"
|
||||
}
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-health.ps1* PowerShell Script
|
||||
## The *check-health.ps1* Script
|
||||
|
||||
This PowerShell script checks some health parameter of the local computer.
|
||||
|
||||
@ -38,16 +38,23 @@ https://github.com/fleschutz/PowerShell
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
& "$PSScriptRoot/check-operating-system.ps1"
|
||||
& "$PSScriptRoot/check-uptime.ps1"
|
||||
& "$PSScriptRoot/check-time-zone.ps1"
|
||||
& "$PSScriptRoot/check-bios.ps1"
|
||||
" "
|
||||
& "$PSScriptRoot/write-green.ps1" " H A R D W A R E"
|
||||
& "$PSScriptRoot/check-cpu.ps1"
|
||||
& "$PSScriptRoot/check-ram.ps1"
|
||||
& "$PSScriptRoot/check-gpu.ps1"
|
||||
& "$PSScriptRoot/check-bios.ps1"
|
||||
& "$PSScriptRoot/check-smart-devices.ps1"
|
||||
& "$PSScriptRoot/check-swap-space.ps1"
|
||||
& "$PSScriptRoot/check-drives.ps1"
|
||||
& "$PSScriptRoot/check-battery.ps1"
|
||||
" "
|
||||
& "$PSScriptRoot/write-green.ps1" " S O F T W A R E"
|
||||
& "$PSScriptRoot/check-os.ps1"
|
||||
& "$PSScriptRoot/check-powershell.ps1"
|
||||
& "$PSScriptRoot/check-apps.ps1"
|
||||
& "$PSScriptRoot/check-uptime.ps1"
|
||||
& "$PSScriptRoot/check-time-zone.ps1"
|
||||
& "$PSScriptRoot/check-swap-space.ps1"
|
||||
& "$PSScriptRoot/check-dns.ps1"
|
||||
& "$PSScriptRoot/check-ping.ps1"
|
||||
& "$PSScriptRoot/check-vpn.ps1"
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-independence-day.ps1* PowerShell Script
|
||||
## The *check-independence-day.ps1* Script
|
||||
|
||||
This PowerShell script checks the time until Indepence Day and replies by text-to-speech (TTS).
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-ipv4-address.ps1* PowerShell Script
|
||||
## The *check-ipv4-address.ps1* Script
|
||||
|
||||
This PowerShell script checks the given IPv4 address for validity.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-ipv6-address.ps1* PowerShell Script
|
||||
## The *check-ipv6-address.ps1* Script
|
||||
|
||||
This PowerShell script checks the given IPv6 address for validity
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-iss-position.ps1* PowerShell Script
|
||||
## The *check-iss-position.ps1* Script
|
||||
|
||||
This PowerShell script queries the position of the International Space Station (ISS) and replies by text-to-speech (TTS).
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-mac-address.ps1* PowerShell Script
|
||||
## The *check-mac-address.ps1* Script
|
||||
|
||||
This PowerShell script checks the given MAC address for validity
|
||||
Supported MAC address formats are: 00:00:00:00:00:00 or 00-00-00-00-00-00 or 000000000000.
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-midnight.ps1* PowerShell Script
|
||||
## The *check-midnight.ps1* Script
|
||||
|
||||
check-midnight.ps1
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-month.ps1* PowerShell Script
|
||||
## The *check-month.ps1* Script
|
||||
|
||||
This PowerShell script determines and speaks the current month name by text-to-speech (TTS).
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-moon-phase.ps1* PowerShell Script
|
||||
## The *check-moon-phase.ps1* Script
|
||||
|
||||
This PowerShell script determines the Moon phase and answers by text-to-speech (TTS).
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-new-year.ps1* PowerShell Script
|
||||
## The *check-new-year.ps1* Script
|
||||
|
||||
This PowerShell script checks the time until New Year and replies by text-to-speech (TTS).
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-noon.ps1* PowerShell Script
|
||||
## The *check-noon.ps1* Script
|
||||
|
||||
check-noon.ps1
|
||||
|
||||
|
64
Docs/check-os.md
Normal file
64
Docs/check-os.md
Normal file
@ -0,0 +1,64 @@
|
||||
## The *check-os.ps1* Script
|
||||
|
||||
This PowerShell script queries and lists operating system details.
|
||||
|
||||
## Parameters
|
||||
```powershell
|
||||
check-os.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
|
||||
```
|
||||
|
||||
## Example
|
||||
```powershell
|
||||
PS> ./check-os
|
||||
|
||||
```
|
||||
|
||||
## Notes
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
|
||||
## Related Links
|
||||
https://github.com/fleschutz/PowerShell
|
||||
|
||||
## Source Code
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Query OS details
|
||||
.DESCRIPTION
|
||||
This PowerShell script queries and lists operating system details.
|
||||
.EXAMPLE
|
||||
PS> ./check-os
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
if ($IsLinux) {
|
||||
"✅ $(uname -sr)"
|
||||
} else {
|
||||
$OS = Get-WmiObject -class Win32_OperatingSystem
|
||||
$Name = $OS.Caption
|
||||
$Arch = $OS.OSArchitecture
|
||||
$Version = $OS.Version
|
||||
|
||||
[system.threading.thread]::currentthread.currentculture = [system.globalization.cultureinfo]"en-US"
|
||||
$OSDetails = Get-CimInstance Win32_OperatingSystem
|
||||
$BuildNo = $OSDetails.BuildNumber
|
||||
$Serial = $OSDetails.SerialNumber
|
||||
$InstallDate = $OSDetails.InstallDate
|
||||
"✅ $($Name) ($Arch, v$Version, S/N $Serial) installed on $($InstallDate.ToShortDateString())"
|
||||
}
|
||||
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-os.ps1*
|
@ -1,4 +1,4 @@
|
||||
## The *check-outlook.ps1* PowerShell Script
|
||||
## The *check-outlook.ps1* Script
|
||||
|
||||
This PowerShell script checks the inbox of Outlook for new/unread mails.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-pending-reboot.ps1* PowerShell Script
|
||||
## The *check-pending-reboot.ps1* Script
|
||||
|
||||
check-pending-reboot.ps1
|
||||
|
||||
@ -72,9 +72,9 @@ if (Test-RegistryValue -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon"
|
||||
$Reason += ", found registry entry '...\CurrentControlSet\Services\Netlogon' with 'AvoidSpnSet'"
|
||||
}
|
||||
if ($Reason -ne "") {
|
||||
"⚠️ Pending reboot ($($Reason.substring(2)))."
|
||||
"⚠️ Pending reboot ($($Reason.substring(2)))"
|
||||
} else {
|
||||
"✅ No pending reboot."
|
||||
"✅ No pending reboot"
|
||||
}
|
||||
exit 0 # success
|
||||
```
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-ping.ps1* PowerShell Script
|
||||
## The *check-ping.ps1* Script
|
||||
|
||||
This PowerShell script checks the ping latency from the local computer to some Internet hosts.
|
||||
|
||||
@ -67,7 +67,7 @@ try {
|
||||
$Avg += $Latency
|
||||
}
|
||||
$Avg /= $Pings.count
|
||||
"✅ Ping is $($Avg)ms average, $($Min)ms min, $($Max)ms max."
|
||||
"✅ Ping is $($Avg)ms average, $($Min)ms min, $($Max)ms max"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
59
Docs/check-powershell.md
Normal file
59
Docs/check-powershell.md
Normal file
@ -0,0 +1,59 @@
|
||||
## The *check-powershell.ps1* Script
|
||||
|
||||
This PowerShell script queries and lists details of PowerShell.
|
||||
|
||||
## Parameters
|
||||
```powershell
|
||||
check-powershell.ps1 [<CommonParameters>]
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
|
||||
```
|
||||
|
||||
## Example
|
||||
```powershell
|
||||
PS> ./check-powershell
|
||||
|
||||
```
|
||||
|
||||
## Notes
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
|
||||
## Related Links
|
||||
https://github.com/fleschutz/PowerShell
|
||||
|
||||
## Source Code
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Query PowerShell details
|
||||
.DESCRIPTION
|
||||
This PowerShell script queries and lists details of PowerShell.
|
||||
.EXAMPLE
|
||||
PS> ./check-powershell
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
$Version = $PSVersionTable.PSVersion
|
||||
$Edition = $PSVersionTable.PSEdition
|
||||
$NumModules = (Get-Module).Count
|
||||
$NumAliases = (Get-Alias).Count
|
||||
if ($IsLinux) {
|
||||
"✅ PowerShell $Version ($Edition edition) with $NumModules modules and $NumAliases aliases"
|
||||
} else {
|
||||
$NumCmdlets = (Get-Command -Command-Type cmdlet).Count
|
||||
"✅ PowerShell $Version ($Edition edition) with $NumModules modules, $NumCmdlets cmdlets and $NumAliases aliases"
|
||||
}
|
||||
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-powershell.ps1*
|
@ -1,4 +1,4 @@
|
||||
## The *check-ram.ps1* PowerShell Script
|
||||
## The *check-ram.ps1* Script
|
||||
|
||||
check-ram.ps1
|
||||
|
||||
@ -68,7 +68,7 @@ try {
|
||||
[float]$Voltage = $Bank.ConfiguredVoltage / 1000.0
|
||||
$Manufacturer = $Bank.Manufacturer
|
||||
$Location = "$($Bank.BankLabel)/$($Bank.DeviceLocator)"
|
||||
"✅ $($Capacity)GB $($Type) by $($Manufacturer): $($Speed)MHz, $($Voltage)V at $Location"
|
||||
"✅ $($Capacity)GB $($Type) at $($Location) ($($Speed)MHz, $($Voltage)V by $Manufacturer)"
|
||||
}
|
||||
}
|
||||
exit 0 # success
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-repo.ps1* PowerShell Script
|
||||
## The *check-repo.ps1* Script
|
||||
|
||||
This PowerShell script verifies the integrity of a local Git repository.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-santa.ps1* PowerShell Script
|
||||
## The *check-santa.ps1* Script
|
||||
|
||||
This PowerShell script checks the time until Saint Nicholas Day and replies by text-to-speech (TTS).
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-smart-devices.ps1* PowerShell Script
|
||||
## The *check-smart-devices.ps1* Script
|
||||
|
||||
check-smart-devices.ps1
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-subnet-mask.ps1* PowerShell Script
|
||||
## The *check-subnet-mask.ps1* Script
|
||||
|
||||
This PowerShell script checks the given subnet mask for validity.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-swap-space.ps1* PowerShell Script
|
||||
## The *check-swap-space.ps1* Script
|
||||
|
||||
This PowerShell script checks the free swap space.
|
||||
|
||||
@ -81,15 +81,15 @@ try {
|
||||
}
|
||||
}
|
||||
if ($Total -eq 0) {
|
||||
"⚠️ No swap space!"
|
||||
"⚠️ No swap space configured!"
|
||||
} elseif ($Free -lt $MinLevel) {
|
||||
"⚠️ Swap space has only $(MB2String $Free) of $(MB2String $Total) left to use!"
|
||||
"⚠️ Only $(MB2String $Free) of $(MB2String $Total) swap space left to use!"
|
||||
} elseif ($Used -eq 0) {
|
||||
"✅ Swap space of $(MB2String $Total) is unused."
|
||||
"✅ Swap space with $(MB2String $Total) reserved"
|
||||
} elseif ($Used -lt $Free) {
|
||||
"✅ Swap space uses $(MB2String $Used) of $(MB2String $Total)."
|
||||
"✅ Swap space uses $(MB2String $Used) of $(MB2String $Total)"
|
||||
} else {
|
||||
"✅ Swap space has $(MB2String $Free) of $(MB2String $Total) left."
|
||||
"✅ Swap space has $(MB2String $Free) of $(MB2String $Total) left to use"
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-symlinks.ps1* PowerShell Script
|
||||
## The *check-symlinks.ps1* Script
|
||||
|
||||
This PowerShell script checks every symbolic link in a folder (including subfolders).
|
||||
It returns the number of broken symlinks as exit value.
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-time-zone.ps1* PowerShell Script
|
||||
## The *check-time-zone.ps1* Script
|
||||
|
||||
This PowerShell script determines and prints the current time zone.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-uptime.ps1* PowerShell Script
|
||||
## The *check-uptime.ps1* Script
|
||||
|
||||
This PowerShell script queries and prints the uptime.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-vpn.ps1* PowerShell Script
|
||||
## The *check-vpn.ps1* Script
|
||||
|
||||
This PowerShell script queries and prints the status of any VPN connection.
|
||||
|
||||
@ -45,11 +45,11 @@ try {
|
||||
} else {
|
||||
$Connections = (Get-VPNConnection)
|
||||
foreach($Connection in $Connections) {
|
||||
"✅ VPN '$($Connection.Name)' is $($Connection.ConnectionStatus)."
|
||||
"✅ VPN '$($Connection.Name)' is $($Connection.ConnectionStatus)"
|
||||
$NoVPN = $false
|
||||
}
|
||||
}
|
||||
if ($NoVPN) { "⚠️ No VPN connection." }
|
||||
if ($NoVPN) { "⚠️ No VPN connection" }
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-weather.ps1* PowerShell Script
|
||||
## The *check-weather.ps1* Script
|
||||
|
||||
This PowerShell script checks the current weather report.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-week.ps1* PowerShell Script
|
||||
## The *check-week.ps1* Script
|
||||
|
||||
This PowerShell script determines and speaks the current week number by text-to-speech (TTS).
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-wind.ps1* PowerShell Script
|
||||
## The *check-wind.ps1* Script
|
||||
|
||||
This PowerShell script determines the current wind conditions and replies by text-to-speech (TTS).
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-windows-system-files.ps1* PowerShell Script
|
||||
## The *check-windows-system-files.ps1* Script
|
||||
|
||||
This PowerShell script checks the validity of the Windows system files. It requires admin rights.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *check-xml-file.ps1* PowerShell Script
|
||||
## The *check-xml-file.ps1* Script
|
||||
|
||||
This PowerShell script checks the given XML file for validity.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *clean-repo.ps1* PowerShell Script
|
||||
## The *clean-repo.ps1* Script
|
||||
|
||||
This PowerShell script deletes all untracked files and folders in a Git repository (including submodules).
|
||||
NOTE: To be used with care! This cannot be undone!
|
||||
@ -61,7 +61,7 @@ try {
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||
|
||||
$RepoDirName = (Get-Item "$RepoDir").Name
|
||||
"⏳ (2/4) Checking folder 📂$RepoDirName..."
|
||||
"⏳ (2/4) Checking Git repository 📂$RepoDirName..."
|
||||
if (-not(Test-Path "$RepoDir" -pathType container)) { throw "Can't access folder '$RepoDir' - maybe a typo or missing folder permissions?" }
|
||||
|
||||
"⏳ (3/4) Removing untracked files in repository..."
|
||||
@ -77,7 +77,7 @@ try {
|
||||
if ($lastExitCode -ne "0") { throw "'git clean' in the submodules failed with exit code $lastExitCode" }
|
||||
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
"✔️ cleaned 📂$RepoDirName repo in $Elapsed sec"
|
||||
"✔️ cleaned Git repository 📂$RepoDirName in $Elapsed sec"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *clean-repos.ps1* PowerShell Script
|
||||
## The *clean-repos.ps1* Script
|
||||
|
||||
This PowerShell script cleans all Git repositories in a folder from untracked files (including submodules).
|
||||
|
||||
@ -54,31 +54,31 @@ param([string]$ParentDir = "$PWD")
|
||||
try {
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
if (-not(test-path "$ParentDir" -pathType container)) { throw "Can't access directory: $ParentDir" }
|
||||
|
||||
$Null = (git --version)
|
||||
Write-Host "⏳ (1) Searching for Git executable... " -noNewline
|
||||
& git --version
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||
|
||||
$Folders = (get-childItem "$ParentDir" -attributes Directory)
|
||||
$FolderCount = $Folders.Count
|
||||
$ParentDirName = (get-item "$ParentDir").Name
|
||||
"Found $FolderCount subfolders in 📂$ParentDirName, cleaning them from untracked files..."
|
||||
$ParentDirName = (Get-Item "$ParentDir").Name
|
||||
Write-Host "⏳ (2) Checking parent folder 📂$ParentDirName... " -noNewline
|
||||
if (-not(Test-Path "$ParentDir" -pathType container)) { throw "Can't access folder: $ParentDir" }
|
||||
$Folders = (Get-ChildItem "$ParentDir" -attributes Directory)
|
||||
$NumFolders = $Folders.Count
|
||||
Write-Host "$NumFolders subfolders found"
|
||||
|
||||
[int]$Step = 1
|
||||
[int]$Step = 2
|
||||
foreach ($Folder in $Folders) {
|
||||
$FolderName = (get-item "$Folder").Name
|
||||
"⏳ Step $Step/$($FolderCount): Cleaning 📂$FolderName..."
|
||||
$FolderName = (Get-Item "$Folder").Name
|
||||
$Step++
|
||||
"⏳ ($Step/$($NumFolders + 2)) Cleaning 📂$FolderName..."
|
||||
|
||||
& git -C "$Folder" clean -xfd -f # force + recurse into dirs + don't use the standard ignore rules
|
||||
if ($lastExitCode -ne "0") { throw "'git clean -xfd -f' failed with exit code $lastExitCode" }
|
||||
|
||||
& git -C "$Folder" submodule foreach --recursive git clean -xfd -f
|
||||
if ($lastExitCode -ne "0") { throw "'git clean -xfd -f' in submodules failed with exit code $lastExitCode" }
|
||||
|
||||
$Step++
|
||||
}
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
"✔️ cleaned $FolderCount Git repositories at 📂$ParentDirName in $Elapsed sec"
|
||||
"✔️ cleaned $NumFolders Git repositories at 📂$ParentDirName in $Elapsed sec."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *clear-dns-cache.ps1* PowerShell Script
|
||||
## The *clear-dns-cache.ps1* Script
|
||||
|
||||
This PowerShell script clears the DNS client cache of the local computer.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *clear-recycle-bin.ps1* PowerShell Script
|
||||
## The *clear-recycle-bin.ps1* Script
|
||||
|
||||
This PowerShell script removes the content of the recycle bin folder permanently.
|
||||
IMPORTANT NOTE: this cannot be undo!
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *clone-repos.ps1* PowerShell Script
|
||||
## The *clone-repos.ps1* Script
|
||||
|
||||
This PowerShell script clones well-known Git repositories into a folder.
|
||||
|
||||
@ -39,7 +39,7 @@ https://github.com/fleschutz/PowerShell
|
||||
.DESCRIPTION
|
||||
This PowerShell script clones well-known Git repositories into a folder.
|
||||
.PARAMETER folder
|
||||
Specifies the target folder
|
||||
Specifies the target folder (default is current working directory)
|
||||
.EXAMPLE
|
||||
PS> ./clone-repos C:\Repos
|
||||
.LINK
|
||||
@ -53,17 +53,17 @@ param([string]$FolderPath = "$PWD")
|
||||
try {
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
"⏳ Step 1 - Searching for Git executable..."
|
||||
Write-Host "⏳ (1) Searching for Git executable... " -noNewline
|
||||
& git --version
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||
|
||||
"⏳ Step 2 - Loading database table in Data/git-repos.csv..."
|
||||
Write-Host "⏳ (2) Loading database table from Data/git-repos.csv... " -noNewline
|
||||
$Table = Import-CSV "$PSScriptRoot/../Data/git-repos.csv"
|
||||
$NumEntries = $Table.count
|
||||
"Found $NumEntries entries."
|
||||
Write-Host "$NumEntries entries found"
|
||||
|
||||
$ParentFolderName = (Get-Item "$FolderPath").Name
|
||||
"⏳ Step 3 - Checking folder 📂$ParentFolderName..."
|
||||
"⏳ (3) Checking target folder 📂$ParentFolderName..."
|
||||
if (-not(Test-Path "$FolderPath" -pathType container)) { throw "Can't access directory: $FolderPath" }
|
||||
|
||||
|
||||
@ -71,23 +71,24 @@ try {
|
||||
[int]$Cloned = 0
|
||||
[int]$Skipped = 0
|
||||
foreach($Row in $Table) {
|
||||
[string]$FolderName = $Row.FolderName
|
||||
[string]$Branch = $Row.Branch
|
||||
[string]$Full = $Row.Full
|
||||
[string]$Group = $Row.GROUP
|
||||
[string]$FolderName = $Row.FOLDERNAME
|
||||
[string]$Branch = $Row.BRANCH
|
||||
[string]$Full = $Row.FULL
|
||||
[string]$URL = $Row.URL
|
||||
$Step++
|
||||
|
||||
if (test-path "$FolderPath/$FolderName" -pathType container) {
|
||||
"⏳ Step $Step/$($NumEntries + 4) - Skipping 📂$($FolderName) (exists already)..."
|
||||
if (Test-Path "$FolderPath/$FolderName" -pathType container) {
|
||||
"⏳ ($Step/$($NumEntries + 4)) Skipping 📂$($FolderName), it exists already..."
|
||||
$Skipped++
|
||||
continue
|
||||
}
|
||||
if ($Full -eq "yes") {
|
||||
"⏳ Step $Step/$($NumEntries + 4) - Cloning into 📂$($FolderName) ($Branch branch with full history)..."
|
||||
"⏳ ($Step/$($NumEntries + 4)) Cloning into 📂$($FolderName) ($Branch branch with full history)..."
|
||||
& git clone --branch "$Branch" --recurse-submodules "$URL" "$FolderPath/$FolderName"
|
||||
if ($lastExitCode -ne "0") { throw "'git clone --branch $Branch $URL' failed with exit code $lastExitCode" }
|
||||
} else {
|
||||
"⏳ Step $Step/$($NumEntries + 4) - Cloning into 📂$FolderName ($Branch branch only)..."
|
||||
"⏳ ($Step/$($NumEntries + 4)) Cloning $Branch branch into 📂$FolderName..."
|
||||
& git clone --branch "$Branch" --single-branch --recurse-submodules "$URL" "$FolderPath/$FolderName"
|
||||
if ($lastExitCode -ne "0") { throw "'git clone --branch $Branch $URL' failed with exit code $lastExitCode" }
|
||||
}
|
||||
@ -95,9 +96,9 @@ try {
|
||||
}
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
if ($Cloned -eq 1) {
|
||||
"✔️ $Cloned repo cloned into 📂$ParentFolderName ($Skipped skipped) in $Elapsed sec"
|
||||
"✔️ 1 Git repository cloned into 📂$ParentFolderName in $Elapsed sec ($Skipped skipped)."
|
||||
} else {
|
||||
"✔️ $Cloned repos cloned into 📂$ParentFolderName ($Skipped skipped) in $Elapsed sec"
|
||||
"✔️ $Cloned Git repos cloned into 📂$ParentFolderName in $Elapsed sec ($Skipped skipped)."
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *close-calculator.ps1* PowerShell Script
|
||||
## The *close-calculator.ps1* Script
|
||||
|
||||
This PowerShell script closes the calculator application gracefully.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *close-chrome.ps1* PowerShell Script
|
||||
## The *close-chrome.ps1* Script
|
||||
|
||||
This PowerShell script closes the Google Chrome Web browser gracefully.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *close-cortana.ps1* PowerShell Script
|
||||
## The *close-cortana.ps1* Script
|
||||
|
||||
This PowerShell script closes Microsoft's Cortana application gracefully.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *close-edge.ps1* PowerShell Script
|
||||
## The *close-edge.ps1* Script
|
||||
|
||||
This PowerShell script closes the Microsoft Edge Web browser gracefully.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *close-file-explorer.ps1* PowerShell Script
|
||||
## The *close-file-explorer.ps1* Script
|
||||
|
||||
This PowerShell script closes the Microsoft File Explorer application gracefully.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *close-firefox.ps1* PowerShell Script
|
||||
## The *close-firefox.ps1* Script
|
||||
|
||||
This PowerShell script closes the Mozilla Firefox Web browser gracefully.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *close-git-extensions.ps1* PowerShell Script
|
||||
## The *close-git-extensions.ps1* Script
|
||||
|
||||
This PowerShell script closes the Git Extensions application gracefully.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *close-magnifier.ps1* PowerShell Script
|
||||
## The *close-magnifier.ps1* Script
|
||||
|
||||
This PowerShell script closes the Windows Screen Magnifier application gracefully.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *close-microsoft-paint.ps1* PowerShell Script
|
||||
## The *close-microsoft-paint.ps1* Script
|
||||
|
||||
This PowerShell script closes the Microsoft Paint application gracefully.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *close-microsoft-store.ps1* PowerShell Script
|
||||
## The *close-microsoft-store.ps1* Script
|
||||
|
||||
This PowerShell script closes the Microsoft Store application gracefully.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *close-netflix.ps1* PowerShell Script
|
||||
## The *close-netflix.ps1* Script
|
||||
|
||||
This PowerShell script closes the Netflix application gracefully.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *close-note-pad.ps1* PowerShell Script
|
||||
## The *close-note-pad.ps1* Script
|
||||
|
||||
This PowerShell script closes the Notepad application gracefully.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *close-obs-studio.ps1* PowerShell Script
|
||||
## The *close-obs-studio.ps1* Script
|
||||
|
||||
This PowerShell script closes the OBS Studio application gracefully.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *close-one-calendar.ps1* PowerShell Script
|
||||
## The *close-one-calendar.ps1* Script
|
||||
|
||||
This PowerShell script closes the OneCalendar application gracefully.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *close-outlook.ps1* PowerShell Script
|
||||
## The *close-outlook.ps1* Script
|
||||
|
||||
This PowerShell script closes the Microsoft Outlook email application gracefully.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *close-paint-three-d.ps1* PowerShell Script
|
||||
## The *close-paint-three-d.ps1* Script
|
||||
|
||||
This PowerShell script closes the Paint 3D application gracefully.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *close-program.ps1* PowerShell Script
|
||||
## The *close-program.ps1* Script
|
||||
|
||||
This PowerShell script closes a program's processes gracefully.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *close-serenade.ps1* PowerShell Script
|
||||
## The *close-serenade.ps1* Script
|
||||
|
||||
This PowerShell script closes the Serenade.ai application gracefully.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *close-snipping-tool.ps1* PowerShell Script
|
||||
## The *close-snipping-tool.ps1* Script
|
||||
|
||||
This PowerShell script closes the Snipping Tool application gracefully.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *close-spotify.ps1* PowerShell Script
|
||||
## The *close-spotify.ps1* Script
|
||||
|
||||
This PowerShell script closes the Spotify application gracefully.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## The *close-task-manager.ps1* PowerShell Script
|
||||
## The *close-task-manager.ps1* Script
|
||||
|
||||
This PowerShell script closes the Task Manager application gracefully.
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user