mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-24 17:03:45 +01:00
Updated the Markdown manuals
This commit is contained in:
parent
dafa6cf1d7
commit
1ffd91c5e2
@ -113,4 +113,4 @@ try {
|
||||
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of add-firewall-rules.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of add-firewall-rules.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -79,4 +79,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of add-memo.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of add-memo.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -71,4 +71,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of alert.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of alert.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -66,18 +66,21 @@ param([string]$path = "$PWD")
|
||||
function BuildInDir([string]$path) {
|
||||
$dirName = (Get-Item "$path").Name
|
||||
if (Test-Path "$path/CMakeLists.txt" -pathType leaf) {
|
||||
"⏳ Building 📂$dirName by using CMake into 📂$dirName/_My_Build..."
|
||||
"⏳ (1/4) Building 📂$dirName by using CMake into 📂$dirName/_My_Build..."
|
||||
if (-not(Test-Path "$path/_My_Build/" -pathType container)) {
|
||||
& mkdir "$path/_My_Build/"
|
||||
}
|
||||
Set-Location "$path/_My_Build/"
|
||||
|
||||
"⏳ (2/4) Executing 'cmake' to generate the Makefile..."
|
||||
& cmake ..
|
||||
if ($lastExitCode -ne "0") { throw "Executing 'cmake ..' has failed" }
|
||||
|
||||
"⏳ (3/4) Executing 'make -j4' to compile and link..."
|
||||
& make -j4
|
||||
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
|
||||
|
||||
"⏳ (4/4) Executing 'make test' to perform tests (optional)..."
|
||||
& make test
|
||||
if ($lastExitCode -ne "0") { throw "Executing 'make test' has failed" }
|
||||
|
||||
@ -189,4 +192,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of build-repo.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of build-repo.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -82,4 +82,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of build-repos.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of build-repos.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -60,4 +60,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-autostart.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-autostart.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -63,4 +63,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-crashdumps.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-crashdumps.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -64,4 +64,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-desktop.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-desktop.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -64,4 +64,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-docs.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-docs.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -64,4 +64,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-downloads.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-downloads.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -60,4 +60,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-dropbox.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-dropbox.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -64,4 +64,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-etc.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-etc.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -60,4 +60,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-fonts.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-fonts.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -60,4 +60,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-home.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-home.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -48,4 +48,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-logs.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-logs.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -64,4 +64,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-music.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-music.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -60,4 +60,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-onedrive.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-onedrive.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -62,4 +62,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-pics.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-pics.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -62,4 +62,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-public.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-public.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -53,4 +53,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-recycle-bin.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-recycle-bin.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -80,4 +80,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-repos.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-repos.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -57,4 +57,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-root.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-root.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -55,4 +55,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-screenshots.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-screenshots.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -17,7 +17,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./cd-scripts
|
||||
📂C:\Users\Markus\source\repos\PowerShell\Scripts
|
||||
📂C:\Users\Markus\source\repos\PowerShell\scripts
|
||||
|
||||
```
|
||||
|
||||
@ -39,7 +39,7 @@ Script Content
|
||||
This PowerShell script changes the working directory to the PowerShell scripts folder.
|
||||
.EXAMPLE
|
||||
PS> ./cd-scripts
|
||||
📂C:\Users\Markus\source\repos\PowerShell\Scripts
|
||||
📂C:\Users\Markus\source\repos\PowerShell\scripts
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -58,4 +58,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-scripts.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-scripts.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -58,4 +58,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-ssh.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-ssh.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -50,4 +50,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-temp.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-temp.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -62,4 +62,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-templates.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-templates.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -53,4 +53,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-trash.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-trash.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -58,4 +58,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -58,4 +58,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up2.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up2.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -58,4 +58,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up3.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up3.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -58,4 +58,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up4.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-up4.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -58,4 +58,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-users.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-users.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -62,4 +62,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-videos.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-videos.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -58,4 +58,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-windows.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of cd-windows.ps1 as of 12/07/2023 20:24:14)*
|
||||
|
@ -79,4 +79,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of change-wallpaper.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of change-wallpaper.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -67,4 +67,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-admin.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-admin.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -48,13 +48,13 @@ Script Content
|
||||
|
||||
try {
|
||||
if ($IsLinux) {
|
||||
Write-Progress "⏳ Querying installed applications..."
|
||||
Write-Progress "Querying installed applications..."
|
||||
$numPkgs = (apt list --installed 2>/dev/null).Count
|
||||
$numSnaps = (snap list).Count - 1
|
||||
Write-Progress -Completed "."
|
||||
Write-Host "✅ $numPkgs Debian packages, $numSnaps snaps installed"
|
||||
} else {
|
||||
Write-Progress "⏳ Querying installed applications..."
|
||||
Write-Progress "Querying installed applications..."
|
||||
$Apps = Get-AppxPackage
|
||||
Write-Progress -Completed "."
|
||||
Write-Host "✅ $($Apps.Count) Windows apps installed, " -noNewline
|
||||
@ -75,4 +75,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-apps.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-apps.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -48,7 +48,7 @@ Script Content
|
||||
|
||||
try {
|
||||
if ($IsLinux) {
|
||||
Write-Progress "⏳ Querying BIOS details..."
|
||||
Write-Progress "Querying BIOS details..."
|
||||
$model = (sudo dmidecode -s system-product-name)
|
||||
if ("$model" -ne "") {
|
||||
$version = (sudo dmidecode -s bios-version)
|
||||
@ -76,4 +76,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-bios.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-bios.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -24,14 +24,26 @@ Script Content
|
||||
This PowerShell script queries the CPU status (name, type, speed, temperature, etc) and prints it.
|
||||
.EXAMPLE
|
||||
PS> ./check-cpu.ps1
|
||||
✅ Intel(R) Core(TM) i9-10900X CPU @ 3.70GHz (AMD64, 20 cores, CPU0, 3696MHz, CPU0 socket, 31.3°C)
|
||||
✅ Intel(R) Core(TM) i9-10900X CPU @ 3.70GHz (AMD64, 20 cores, CPU0, 3696MHz, CPU0 socket, 31.3°C)
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
function GetProcessorTemperature {
|
||||
function GetCPUArchitecture {
|
||||
if ("$env:PROCESSOR_ARCHITECTURE" -ne "") { return "$env:PROCESSOR_ARCHITECTURE" }
|
||||
if ($IsLinux) {
|
||||
$Name = $PSVersionTable.OS
|
||||
if ($Name -like "*-generic *") {
|
||||
if ([System.Environment]::Is64BitOperatingSystem) { return "x64" } else { return "x86" }
|
||||
} elseif ($Name -like "*-raspi *") {
|
||||
if ([System.Environment]::Is64BitOperatingSystem) { return "ARM64" } else { return "ARM32" }
|
||||
} elseif ([System.Environment]::Is64BitOperatingSystem) { return "64-bit" } else { return "32-bit" }
|
||||
}
|
||||
}
|
||||
|
||||
function GetCPUTemperature {
|
||||
$temp = 99999.9 # unsupported
|
||||
if ($IsLinux) {
|
||||
if (Test-Path "/sys/class/thermal/thermal_zone0/temp" -pathType leaf) {
|
||||
@ -48,37 +60,10 @@ function GetProcessorTemperature {
|
||||
return $temp
|
||||
}
|
||||
|
||||
function GetProcessorArchitecture {
|
||||
if ("$env:PROCESSOR_ARCHITECTURE" -ne "") { return "$env:PROCESSOR_ARCHITECTURE" }
|
||||
if ($IsLinux) {
|
||||
$Name = $PSVersionTable.OS
|
||||
if ($Name -like "*-generic *") {
|
||||
if ([System.Environment]::Is64BitOperatingSystem) { return "x64" } else { return "x86" }
|
||||
} elseif ($Name -like "*-raspi *") {
|
||||
if ([System.Environment]::Is64BitOperatingSystem) { return "ARM64" } else { return "ARM32" }
|
||||
} else {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
Write-Progress "⏳ Querying CPU status... "
|
||||
Write-Progress "Querying CPU status... "
|
||||
$status = "✅"
|
||||
$celsius = GetProcessorTemperature
|
||||
if ($celsius -eq 99999.9) {
|
||||
$temp = "no temp"
|
||||
} elseif ($celsius -gt 50) {
|
||||
$temp = "$($celsius)°C"
|
||||
$status = "⚠️"
|
||||
} elseif ($celsius -lt 0) {
|
||||
$temp = "$($celsius)°C"
|
||||
$status = "⚠️"
|
||||
} else {
|
||||
$temp = "$($celsius)°C"
|
||||
}
|
||||
|
||||
$arch = GetProcessorArchitecture
|
||||
$arch = GetCPUArchitecture
|
||||
if ($IsLinux) {
|
||||
$cpuName = "$arch CPU"
|
||||
$arch = ""
|
||||
@ -94,7 +79,20 @@ try {
|
||||
$socket = "$($details.SocketDesignation) socket, "
|
||||
}
|
||||
$cores = [System.Environment]::ProcessorCount
|
||||
Write-Progress -completed " "
|
||||
$celsius = GetCPUTemperature
|
||||
if ($celsius -eq 99999.9) {
|
||||
$temp = "no temp"
|
||||
} elseif ($celsius -gt 50) {
|
||||
$temp = "$($celsius)°C"
|
||||
$status = "⚠️"
|
||||
} elseif ($celsius -lt 0) {
|
||||
$temp = "$($celsius)°C"
|
||||
$status = "⚠️"
|
||||
} else {
|
||||
$temp = "$($celsius)°C"
|
||||
}
|
||||
|
||||
Write-Progress -completed "Done."
|
||||
Write-Host "$status $cpuName ($($arch)$cores cores, $($deviceID)$($speed)$($socket)$temp)"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
@ -103,4 +101,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-cpu.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-cpu.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -57,4 +57,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-day.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-day.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -47,8 +47,8 @@ Script Content
|
||||
#>
|
||||
|
||||
try {
|
||||
Write-Progress "⏳ Measuring DNS resolution..."
|
||||
$table = Import-CSV "$PSScriptRoot/../Data/popular-domains.csv"
|
||||
Write-Progress "Measuring DNS resolution..."
|
||||
$table = Import-CSV "$PSScriptRoot/../data/popular-domains.csv"
|
||||
$numRows = $table.Length
|
||||
|
||||
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
@ -73,4 +73,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-dns.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-dns.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -91,4 +91,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-drive-space.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-drive-space.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -76,10 +76,10 @@ function Bytes2String { param([int64]$bytes)
|
||||
}
|
||||
|
||||
try {
|
||||
Write-Progress "⏳ Querying drives..."
|
||||
Write-Progress "Querying drives..."
|
||||
$drives = Get-PSDrive -PSProvider FileSystem
|
||||
$minLevel *= 1000 * 1000 * 1000
|
||||
Write-Progress -completed "."
|
||||
Write-Progress -completed " "
|
||||
foreach($drive in $drives) {
|
||||
$details = (Get-PSDrive $drive.Name)
|
||||
if ($IsLinux) { $name = $drive.Name } else { $name = $drive.Name + ":" }
|
||||
@ -105,4 +105,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-drives.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-drives.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -63,4 +63,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-dusk.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-dusk.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -61,4 +61,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-easter-sunday.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-easter-sunday.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -75,4 +75,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-file-system.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-file-system.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -170,4 +170,4 @@ function Check-Header { param( $path )
|
||||
Check-Header $Path
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-file.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-file.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -65,4 +65,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-firewall.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-firewall.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -65,4 +65,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-gpu.ps1 as of 10/19/2023 08:11:35)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-gpu.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -63,4 +63,4 @@ Script Content
|
||||
exit 0 # success
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-hardware.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-hardware.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -58,4 +58,4 @@ Script Content
|
||||
exit 0 # success
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-health.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-health.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -61,4 +61,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-independence-day.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-independence-day.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -84,4 +84,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-ipv4-address.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-ipv4-address.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -98,4 +98,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-ipv6-address.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-ipv6-address.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -55,4 +55,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-iss-position.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-iss-position.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -87,4 +87,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-mac-address.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-mac-address.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -60,4 +60,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-midnight.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-midnight.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -57,4 +57,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-month.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-month.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -76,4 +76,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-moon-phase.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-moon-phase.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -64,4 +64,4 @@ Script Content
|
||||
exit 0 # success
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-network.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-network.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -60,4 +60,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-new-year.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-new-year.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -59,4 +59,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-noon.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-noon.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -50,7 +50,7 @@ try {
|
||||
if ($IsLinux) {
|
||||
$Name = $PSVersionTable.OS
|
||||
if ([System.Environment]::Is64BitOperatingSystem) { $Arch = "64-bit" } else { $Arch = "32-bit" }
|
||||
Write-Host "✅ $Name $Arch"
|
||||
Write-Host "✅ $Name (Linux $Arch)"
|
||||
} else {
|
||||
$OS = Get-WmiObject -class Win32_OperatingSystem
|
||||
$Name = $OS.Caption -Replace "Microsoft Windows","Windows"
|
||||
@ -73,4 +73,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-os.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-os.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -65,4 +65,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-outlook.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-outlook.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -94,4 +94,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-password.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-password.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -92,4 +92,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-pending-reboot.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-pending-reboot.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -90,4 +90,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-ping.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-ping.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -92,4 +92,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-power.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-power.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -64,4 +64,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-powershell.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-powershell.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -76,4 +76,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-ps1-file.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-ps1-file.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -98,4 +98,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-ram.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-ram.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -128,4 +128,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-repo.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-repo.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -56,4 +56,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-santa.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-santa.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -48,11 +48,11 @@ function Bytes2String { param([int64]$Bytes)
|
||||
}
|
||||
|
||||
try {
|
||||
Write-Progress "⏳ (1/3) Searching for smartmontools..."
|
||||
Write-Progress "(1/3) Searching for smartmontools..."
|
||||
$Result = (smartctl --version)
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'smartctl' - make sure smartmontools are installed" }
|
||||
|
||||
Write-Progress "⏳ (2/3) Scanning S.M.A.R.T devices..."
|
||||
Write-Progress "(2/3) Scanning S.M.A.R.T devices..."
|
||||
if ($IsLinux) {
|
||||
$Devices = $(sudo smartctl --scan-open)
|
||||
} else {
|
||||
@ -60,7 +60,7 @@ try {
|
||||
}
|
||||
|
||||
foreach($Device in $Devices) {
|
||||
Write-Progress "⏳ (3/3) Querying S.M.A.R.T devices..."
|
||||
Write-Progress "(3/3) Querying S.M.A.R.T devices..."
|
||||
$Array = $Device.split(" ")
|
||||
$Device = $Array[0]
|
||||
if ("$Device" -eq "#") {
|
||||
@ -95,4 +95,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-smart-devices.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-smart-devices.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -69,4 +69,4 @@ Script Content
|
||||
exit 0 # success
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-software.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-software.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -84,4 +84,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-subnet-mask.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-subnet-mask.ps1 as of 12/07/2023 20:24:15)*
|
||||
|
@ -105,4 +105,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-swap-space.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-swap-space.ps1 as of 12/07/2023 20:24:16)*
|
||||
|
@ -100,4 +100,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-symlinks.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-symlinks.ps1 as of 12/07/2023 20:24:16)*
|
||||
|
@ -65,4 +65,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-time-zone.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-time-zone.ps1 as of 12/07/2023 20:24:16)*
|
||||
|
@ -61,4 +61,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-uptime.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-uptime.ps1 as of 12/07/2023 20:24:16)*
|
||||
|
@ -65,4 +65,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-vpn.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-vpn.ps1 as of 12/07/2023 20:24:16)*
|
||||
|
@ -81,4 +81,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-weather.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-weather.ps1 as of 12/07/2023 20:24:16)*
|
||||
|
@ -54,4 +54,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-week.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-week.ps1 as of 12/07/2023 20:24:16)*
|
||||
|
@ -72,4 +72,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-wind.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-wind.ps1 as of 12/07/2023 20:24:16)*
|
||||
|
@ -60,4 +60,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-windows-system-files.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-windows-system-files.ps1 as of 12/07/2023 20:24:16)*
|
||||
|
@ -6,9 +6,9 @@ This PowerShell script checks the given XML file for validity.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-xml-file.ps1 [[-file] <String>] [<CommonParameters>]
|
||||
PS> ./check-xml-file.ps1 [[-path] <String>] [<CommonParameters>]
|
||||
|
||||
-file <String>
|
||||
-path <String>
|
||||
Specifies the path to the XML file to check
|
||||
|
||||
Required? false
|
||||
@ -25,8 +25,8 @@ PS> ./check-xml-file.ps1 [[-file] <String>] [<CommonParameters>]
|
||||
Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./check-xml-file myfile.xml
|
||||
✔️ XML file is valid
|
||||
PS> ./check-xml-file.ps1 myfile.xml
|
||||
✔️ Valid XML in 'myfile.xml'
|
||||
|
||||
```
|
||||
|
||||
@ -43,30 +43,29 @@ Script Content
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checks the given XML file for validity
|
||||
Verifies the given XML file
|
||||
.DESCRIPTION
|
||||
This PowerShell script checks the given XML file for validity.
|
||||
.PARAMETER file
|
||||
.PARAMETER path
|
||||
Specifies the path to the XML file to check
|
||||
.EXAMPLE
|
||||
PS> ./check-xml-file myfile.xml
|
||||
✔️ XML file is valid
|
||||
PS> ./check-xml-file.ps1 myfile.xml
|
||||
✔️ Valid XML in 'myfile.xml'
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
param([string]$file = "")
|
||||
param([string]$path = "")
|
||||
|
||||
try {
|
||||
if ($file -eq "" ) { $file = read-host "Enter path to XML file" }
|
||||
if ($path -eq "" ) { $path = Read-Host "Enter path to XML file" }
|
||||
|
||||
$XmlFile = Get-Item $file
|
||||
|
||||
$script:ErrorCount = 0
|
||||
$XmlFile = Get-Item $path
|
||||
|
||||
# Perform the XSD Validation
|
||||
$script:ErrorCount = 0
|
||||
$ReaderSettings = New-Object -TypeName System.Xml.XmlReaderSettings
|
||||
$ReaderSettings.ValidationType = [System.Xml.ValidationType]::Schema
|
||||
$ReaderSettings.ValidationFlags = [System.Xml.Schema.XmlSchemaValidationFlags]::ProcessInlineSchema -bor [System.Xml.Schema.XmlSchemaValidationFlags]::ProcessSchemaLocation
|
||||
@ -76,11 +75,10 @@ try {
|
||||
$Reader.Close()
|
||||
|
||||
if ($script:ErrorCount -gt 0) {
|
||||
write-warning "Invalid XML file"
|
||||
exit 1
|
||||
throw "Invalid XML in '$path'"
|
||||
}
|
||||
|
||||
"✔️ XML file is valid"
|
||||
"✔️ Valid XML in '$path'"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -88,4 +86,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-xml-file.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of check-xml-file.ps1 as of 12/07/2023 20:24:16)*
|
||||
|
86
docs/check-xml-files.md
Normal file
86
docs/check-xml-files.md
Normal file
@ -0,0 +1,86 @@
|
||||
*check-xml-files.ps1*
|
||||
================
|
||||
|
||||
This PowerShell script verifies each XML file in the given directory tree for validity.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./check-xml-files.ps1 [[-path] <String>] [<CommonParameters>]
|
||||
|
||||
-path <String>
|
||||
Specifies the path to the directory tree (current working dir by default)
|
||||
|
||||
Required? false
|
||||
Position? 1
|
||||
Default value "$PWD"
|
||||
Accept pipeline input? false
|
||||
Accept wildcard characters? false
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
|
||||
```
|
||||
|
||||
Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./check-xml-files.ps1 C:\Windows
|
||||
...
|
||||
✔️ Checked 3607 XML files within C:\Windows in 174 sec
|
||||
|
||||
```
|
||||
|
||||
Notes
|
||||
-----
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
|
||||
Related Links
|
||||
-------------
|
||||
https://github.com/fleschutz/PowerShell
|
||||
|
||||
Script Content
|
||||
--------------
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checks XML files in a directory tree
|
||||
.DESCRIPTION
|
||||
This PowerShell script verifies each XML file in the given directory tree for validity.
|
||||
.PARAMETER path
|
||||
Specifies the path to the directory tree (current working dir by default)
|
||||
.EXAMPLE
|
||||
PS> ./check-xml-files.ps1 C:\Windows
|
||||
...
|
||||
✔️ Checked 3607 XML files within C:\Windows in 174 sec
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
param([string]$path = "$PWD")
|
||||
|
||||
try {
|
||||
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
$path = Resolve-Path "$path"
|
||||
[int]$count = 0
|
||||
|
||||
Write-Progress "Checking all *.xml files under $path..."
|
||||
Get-ChildItem -path "$path" -attributes !Directory -recurse -force | Where-Object { $_.Name -like "*.xml*" } | Foreach-Object {
|
||||
& $PSScriptRoot/check-xml-file.ps1 "$($_.FullName)"
|
||||
$count++
|
||||
}
|
||||
Write-Progress -completed "Done."
|
||||
|
||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||
"✔️ Checked $count XML files within $path in $elapsed sec"
|
||||
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-xml-files.ps1 as of 12/07/2023 20:24:16)*
|
@ -101,4 +101,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clean-repo.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clean-repo.ps1 as of 12/07/2023 20:24:16)*
|
||||
|
@ -100,4 +100,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clean-repos.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clean-repos.ps1 as of 12/07/2023 20:24:16)*
|
||||
|
@ -60,4 +60,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clear-dns-cache.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clear-dns-cache.ps1 as of 12/07/2023 20:24:16)*
|
||||
|
@ -58,4 +58,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clear-recycle-bin.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clear-recycle-bin.ps1 as of 12/07/2023 20:24:16)*
|
||||
|
@ -1,14 +1,14 @@
|
||||
*clone-repos.ps1*
|
||||
================
|
||||
|
||||
This PowerShell script clones popular Git repositories into a target directory.
|
||||
This PowerShell script clones popular Git repositories into a common target directory.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./clone-repos.ps1 [[-TargetDir] <String>] [<CommonParameters>]
|
||||
PS> ./clone-repos.ps1 [[-targetDir] <String>] [<CommonParameters>]
|
||||
|
||||
-TargetDir <String>
|
||||
-targetDir <String>
|
||||
Specifies the file path to the target directory (current working directory by default)
|
||||
|
||||
Required? false
|
||||
@ -25,12 +25,9 @@ PS> ./clone-repos.ps1 [[-TargetDir] <String>] [<CommonParameters>]
|
||||
Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./clone-repos C:\Repos
|
||||
⏳ (1) Searching for Git executable... git version 2.41.0.windows.3
|
||||
⏳ (2) Reading Data/popular-repositories.csv... 28 repos
|
||||
⏳ (3) Checking target folder... 📂repos
|
||||
⏳ (4/32) Cloning into 📂base256unicode (dev tool)...
|
||||
PS> ./clone-repos C:\MyRepos
|
||||
...
|
||||
✔️ Cloned 29 of 29 Git repos into 📂MyRepos in 123 sec
|
||||
|
||||
```
|
||||
|
||||
@ -49,69 +46,65 @@ Script Content
|
||||
.SYNOPSIS
|
||||
Clones Git repos
|
||||
.DESCRIPTION
|
||||
This PowerShell script clones popular Git repositories into a target directory.
|
||||
This PowerShell script clones popular Git repositories into a common target directory.
|
||||
.PARAMETER targetDir
|
||||
Specifies the file path to the target directory (current working directory by default)
|
||||
.EXAMPLE
|
||||
PS> ./clone-repos C:\Repos
|
||||
⏳ (1) Searching for Git executable... git version 2.41.0.windows.3
|
||||
⏳ (2) Reading Data/popular-repositories.csv... 28 repos
|
||||
⏳ (3) Checking target folder... 📂repos
|
||||
⏳ (4/32) Cloning into 📂base256unicode (dev tool)...
|
||||
PS> ./clone-repos C:\MyRepos
|
||||
...
|
||||
✔️ Cloned 29 of 29 Git repos into 📂MyRepos in 123 sec
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
param([string]$TargetDir = "$PWD")
|
||||
param([string]$targetDir = "$PWD")
|
||||
|
||||
try {
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
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" }
|
||||
|
||||
Write-Host "⏳ (2) Reading Data/popular-repositories.csv... " -noNewline
|
||||
$Table = Import-CSV "$PSScriptRoot/../Data/popular-repositories.csv"
|
||||
$NumEntries = $Table.count
|
||||
Write-Host "$NumEntries repos"
|
||||
Write-Host "⏳ (2) Reading data/popular-repositories.csv... " -noNewline
|
||||
$table = Import-CSV "$PSScriptRoot/../data/popular-repositories.csv"
|
||||
$total = $table.count
|
||||
Write-Host "$total repos"
|
||||
|
||||
$TargetDirName = (Get-Item "$TargetDir").Name
|
||||
Write-Host "⏳ (3) Checking target folder... 📂$TargetDirName"
|
||||
if (-not(Test-Path "$TargetDir" -pathType container)) { throw "Can't access directory: $TargetDir" }
|
||||
$targetDirName = (Get-Item "$targetDir").Name
|
||||
Write-Host "⏳ (3) Checking target folder... 📂$targetDirName"
|
||||
if (-not(Test-Path "$targetDir" -pathType container)) { throw "Can't access directory: $targetDir" }
|
||||
|
||||
[int]$Step = 3
|
||||
[int]$Cloned = 0
|
||||
[int]$Skipped = 0
|
||||
foreach($Row in $Table) {
|
||||
[string]$FolderName = $Row.FOLDERNAME
|
||||
[string]$Category = $Row.CATEGORY
|
||||
[string]$Branch = $Row.BRANCH
|
||||
[string]$Shallow = $Row.SHALLOW
|
||||
[string]$URL = $Row.URL
|
||||
$Step++
|
||||
[int]$step = 3
|
||||
[int]$cloned = 0
|
||||
[int]$skipped = 0
|
||||
foreach($row in $table) {
|
||||
[string]$folderName = $row.FOLDERNAME
|
||||
[string]$category = $row.CATEGORY
|
||||
[string]$URL = $row.URL
|
||||
[string]$branch = $row.BRANCH
|
||||
[string]$shallow = $row.SHALLOW
|
||||
$step++
|
||||
|
||||
if (Test-Path "$TargetDir/$FolderName" -pathType container) {
|
||||
"⏳ ($Step/$($NumEntries + 4)) Skipping existing 📂$FolderName ($Category)..."
|
||||
$Skipped++
|
||||
continue
|
||||
}
|
||||
if ($Shallow -eq "yes") {
|
||||
"⏳ ($Step/$($NumEntries + 4)) Cloning into 📂$FolderName ($Category) - $Branch branch only..."
|
||||
& 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 (Test-Path "$targetDir/$folderName" -pathType container) {
|
||||
"⏳ ($step/$($total + 4)) Skipping existing 📂$folderName (a $category)..."
|
||||
$skipped++
|
||||
} elseif ($shallow -eq "yes") {
|
||||
"⏳ ($step/$($total + 4)) Cloning into 📂$folderName (a $category, $branch branch, shallow)..."
|
||||
& git clone --branch "$branch" --single-branch --recurse-submodules "$URL" "$targetDir/$folderName"
|
||||
if ($lastExitCode -ne "0") { throw "'git clone --branch $branch $URL' failed with exit code $lastExitCode" }
|
||||
$cloned++
|
||||
} else {
|
||||
"⏳ ($Step/$($NumEntries + 4)) Cloning into 📂$FolderName ($Category) - $Branch branch with full history..."
|
||||
& git clone --branch "$Branch" --recurse-submodules "$URL" "$TargetDir/$FolderName"
|
||||
if ($lastExitCode -ne "0") { throw "'git clone --branch $Branch $URL' failed with exit code $lastExitCode" }
|
||||
"⏳ ($step/$($total + 4)) Cloning into 📂$folderName (a $category, $branch branch, full history)..."
|
||||
& git clone --branch "$branch" --recurse-submodules "$URL" "$targetDir/$folderName"
|
||||
if ($lastExitCode -ne "0") { throw "'git clone --branch $branch $URL' failed with exit code $lastExitCode" }
|
||||
$clone++
|
||||
}
|
||||
$Cloned++
|
||||
}
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
"✔️ Cloning $Cloned of $NumEntries Git repos into folder 📂$TargetDirName took $Elapsed sec"
|
||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||
"✔️ Cloned $cloned of $total Git repos into 📂$targetDirName in $elapsed sec"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -119,4 +112,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clone-repos.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clone-repos.ps1 as of 12/07/2023 20:24:16)*
|
||||
|
@ -48,4 +48,4 @@ Stop-Process -name "CalculatorApp"
|
||||
exit 0 # success
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of close-calculator.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of close-calculator.ps1 as of 12/07/2023 20:24:16)*
|
||||
|
@ -48,4 +48,4 @@ Script Content
|
||||
exit 0 # success
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of close-chrome.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of close-chrome.ps1 as of 12/07/2023 20:24:16)*
|
||||
|
@ -48,4 +48,4 @@ Script Content
|
||||
exit 0 # success
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of close-cortana.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of close-cortana.ps1 as of 12/07/2023 20:24:16)*
|
||||
|
@ -52,4 +52,4 @@ if ($lastExitCode -ne "0") {
|
||||
exit 0 # success
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of close-edge.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of close-edge.ps1 as of 12/07/2023 20:24:16)*
|
||||
|
@ -48,4 +48,4 @@ Script Content
|
||||
exit 0 # success
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of close-file-explorer.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of close-file-explorer.ps1 as of 12/07/2023 20:24:16)*
|
||||
|
@ -48,4 +48,4 @@ Script Content
|
||||
exit 0 # success
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of close-firefox.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of close-firefox.ps1 as of 12/07/2023 20:24:16)*
|
||||
|
@ -52,4 +52,4 @@ if ($lastExitCode -ne "0") {
|
||||
exit 0 # success
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of close-git-extensions.ps1 as of 10/19/2023 08:11:36)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of close-git-extensions.ps1 as of 12/07/2023 20:24:16)*
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user