2021-09-27 10:38:12 +02:00
|
|
|
|
<#
|
2021-07-13 21:10:02 +02:00
|
|
|
|
.SYNOPSIS
|
2023-04-25 14:17:42 +02:00
|
|
|
|
Lists all PowerShell scripts
|
2021-07-13 21:10:02 +02:00
|
|
|
|
.DESCRIPTION
|
2022-01-29 12:47:46 +01:00
|
|
|
|
This PowerShell script lists all PowerShell scripts in the repository (sorted alphabetically).
|
2021-07-13 21:10:02 +02:00
|
|
|
|
.EXAMPLE
|
2023-08-06 21:35:36 +02:00
|
|
|
|
PS> ./list-scripts.ps1
|
2021-07-13 21:10:02 +02:00
|
|
|
|
.LINK
|
|
|
|
|
https://github.com/fleschutz/PowerShell
|
2022-01-29 12:47:46 +01:00
|
|
|
|
.NOTES
|
2022-09-06 21:42:04 +02:00
|
|
|
|
Author: Markus Fleschutz | License: CC0
|
2020-12-29 15:37:12 +01:00
|
|
|
|
#>
|
|
|
|
|
|
2021-01-28 07:54:49 +01:00
|
|
|
|
function ListScripts { param([string]$FilePath)
|
2023-04-25 14:17:42 +02:00
|
|
|
|
Write-Progress "Reading $FilePath..."
|
|
|
|
|
$table = Import-CSV "$FilePath"
|
|
|
|
|
[int]$No = 1
|
|
|
|
|
foreach($row in $table) {
|
2021-01-02 12:16:16 +01:00
|
|
|
|
New-Object PSObject -Property @{
|
2023-04-25 14:17:42 +02:00
|
|
|
|
'No' = $No++
|
|
|
|
|
'Script' = $row.SCRIPT
|
|
|
|
|
'Description' = $row.DESCRIPTION
|
2021-01-02 12:16:16 +01:00
|
|
|
|
}
|
2020-12-29 15:37:12 +01:00
|
|
|
|
}
|
2021-02-22 20:14:44 +01:00
|
|
|
|
$global:NumScripts = $Table.Count
|
2023-04-25 14:17:42 +02:00
|
|
|
|
Write-Progress -completed "."
|
2021-01-02 12:16:16 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
2023-09-18 18:48:56 +02:00
|
|
|
|
ListScripts "$PSScriptRoot/../Data/scripts.csv" | Format-Table -property No,Script,Description
|
|
|
|
|
# $files = Get-ChildItem -path "./*.ps1" -attributes !Directory
|
|
|
|
|
# foreach ($file in $files) {
|
|
|
|
|
# $help = Get-Help $file -full
|
|
|
|
|
# Write-Output "$($file.Name),$($help.Synopsis),"
|
|
|
|
|
# }
|
2021-09-27 10:09:45 +02:00
|
|
|
|
exit 0 # success
|
2020-12-29 15:37:12 +01:00
|
|
|
|
} catch {
|
2022-04-13 12:06:32 +02:00
|
|
|
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
2020-12-29 15:37:12 +01:00
|
|
|
|
exit 1
|
|
|
|
|
}
|