2021-09-27 10:38:12 +02:00
|
|
|
|
<#
|
2021-07-22 10:49:42 +02:00
|
|
|
|
.SYNOPSIS
|
2021-09-24 17:19:49 +02:00
|
|
|
|
Lists available command-line interface (CLI) tools
|
2021-10-04 21:29:23 +02:00
|
|
|
|
.DESCRIPTION
|
2021-10-16 13:40:20 +02:00
|
|
|
|
This script lists available command-line interface (CLI) tools.
|
2021-07-22 10:49:42 +02:00
|
|
|
|
.EXAMPLE
|
2021-09-24 17:19:49 +02:00
|
|
|
|
PS> ./list-cli-tools
|
2021-09-29 21:50:10 +02:00
|
|
|
|
|
|
|
|
|
Name Version Location FileSize
|
|
|
|
|
---- ------- -------- --------
|
|
|
|
|
at 10.0.19041.1 C:\WINDOWS\system32\at.exe 31232
|
|
|
|
|
attrib 10.0.19041.1 C:\WINDOWS\system32\attrib.exe 23040
|
|
|
|
|
...
|
2021-08-29 17:50:03 +02:00
|
|
|
|
.NOTES
|
|
|
|
|
Author: Markus Fleschutz · License: CC0
|
2021-07-22 10:49:42 +02:00
|
|
|
|
.LINK
|
|
|
|
|
https://github.com/fleschutz/PowerShell
|
|
|
|
|
#>
|
|
|
|
|
|
2021-07-26 20:09:48 +02:00
|
|
|
|
function CheckFor { param([string]$Cmd, [string]$VersionArg)
|
2021-07-22 20:04:58 +02:00
|
|
|
|
try {
|
|
|
|
|
$Info = Get-Command $Cmd -ErrorAction Stop
|
|
|
|
|
$Location = $Info.Source
|
2021-08-02 08:39:17 +02:00
|
|
|
|
if ("$($Info.Version)" -eq "0.0.0.0") {
|
2021-07-28 14:48:57 +02:00
|
|
|
|
if ("$VersionArg" -ne "") {
|
|
|
|
|
$Result = invoke-expression "$Location $VersionArg"
|
2021-08-02 08:39:17 +02:00
|
|
|
|
if ("$Result" -match '\d+.\d+\.\d+') {
|
|
|
|
|
$Version = "$($Matches[0])"
|
|
|
|
|
} elseif ("$Result" -match '\d+\.\d+') {
|
2021-07-28 14:48:57 +02:00
|
|
|
|
$Version = "$($Matches[0])"
|
|
|
|
|
} else {
|
2021-08-02 08:39:17 +02:00
|
|
|
|
$Version = ""
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$Version = ""
|
2021-07-26 20:09:48 +02:00
|
|
|
|
}
|
2021-08-02 08:39:17 +02:00
|
|
|
|
} else {
|
|
|
|
|
$Version = $Info.Version
|
2021-07-26 20:09:48 +02:00
|
|
|
|
}
|
2021-07-22 20:04:58 +02:00
|
|
|
|
if (test-path "$Location" -pathType leaf) {
|
|
|
|
|
$FileSize = (Get-Item "$Location").Length
|
|
|
|
|
} else {
|
|
|
|
|
$FileSize = "0"
|
|
|
|
|
}
|
2021-07-26 20:09:48 +02:00
|
|
|
|
new-object PSObject -Property @{ Name=$Cmd; Version=$Version; Location=$Location; FileSize=$FileSize }
|
2021-07-22 20:04:58 +02:00
|
|
|
|
} catch {
|
|
|
|
|
return
|
|
|
|
|
}
|
2021-07-22 10:49:42 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function ListTools {
|
2021-08-24 21:20:33 +02:00
|
|
|
|
CheckFor 7z "-version"
|
|
|
|
|
CheckFor ant "-v"
|
|
|
|
|
CheckFor apt "--version"
|
2021-07-26 20:09:48 +02:00
|
|
|
|
CheckFor apt-get "--version"
|
2021-08-24 21:20:33 +02:00
|
|
|
|
CheckFor amixer "--version"
|
|
|
|
|
CheckFor aplay "--version"
|
|
|
|
|
CheckFor ar "--version"
|
2021-07-26 20:09:48 +02:00
|
|
|
|
CheckFor arecord "--version"
|
2021-08-24 21:20:33 +02:00
|
|
|
|
CheckFor at ""
|
|
|
|
|
CheckFor attrib ""
|
|
|
|
|
CheckFor awk "--version"
|
2021-07-26 20:09:48 +02:00
|
|
|
|
CheckFor basename "--version"
|
2021-08-24 21:20:33 +02:00
|
|
|
|
CheckFor bash "--version"
|
|
|
|
|
CheckFor bc "--version"
|
|
|
|
|
CheckFor cc "--version"
|
|
|
|
|
CheckFor chdsk ""
|
2021-08-02 15:51:01 +02:00
|
|
|
|
CheckFor chkntfs ""
|
|
|
|
|
CheckFor cipher ""
|
2021-08-24 21:20:33 +02:00
|
|
|
|
CheckFor cksum "--version"
|
|
|
|
|
CheckFor clang "--version"
|
|
|
|
|
CheckFor cmake "--version"
|
|
|
|
|
CheckFor cmd ""
|
|
|
|
|
CheckFor comp ""
|
2021-08-02 15:51:01 +02:00
|
|
|
|
CheckFor compact ""
|
2021-08-24 21:20:33 +02:00
|
|
|
|
CheckFor cpack "--version"
|
|
|
|
|
CheckFor ctest "--version"
|
|
|
|
|
CheckFor curl "--version"
|
|
|
|
|
CheckFor cut "--version"
|
|
|
|
|
CheckFor date ""
|
|
|
|
|
CheckFor diff "--version"
|
|
|
|
|
CheckFor dism ""
|
2021-08-02 15:51:01 +02:00
|
|
|
|
CheckFor driverquery ""
|
2021-08-24 21:20:33 +02:00
|
|
|
|
CheckFor find "--version"
|
|
|
|
|
CheckFor ftp "--version"
|
|
|
|
|
CheckFor gcc "--version"
|
|
|
|
|
CheckFor gdb "--version"
|
|
|
|
|
CheckFor gh "--version"
|
|
|
|
|
CheckFor git "--version"
|
|
|
|
|
CheckFor gpg "--version"
|
2021-10-20 10:19:57 +02:00
|
|
|
|
CheckFor hcsdiag ""
|
2021-08-24 21:20:33 +02:00
|
|
|
|
CheckFor help "--version"
|
2021-08-02 15:51:01 +02:00
|
|
|
|
CheckFor hostname ""
|
2021-08-24 21:20:33 +02:00
|
|
|
|
CheckFor htop "--version"
|
|
|
|
|
CheckFor ipfs "--version"
|
|
|
|
|
CheckFor java "--version"
|
2021-08-02 08:39:17 +02:00
|
|
|
|
CheckFor lsb_release ""
|
2021-08-24 21:20:33 +02:00
|
|
|
|
CheckFor lzma "--version"
|
|
|
|
|
CheckFor make "--version"
|
2021-07-26 20:09:48 +02:00
|
|
|
|
CheckFor md5sum "--version"
|
|
|
|
|
CheckFor mkfifo "--version"
|
2021-09-13 14:48:25 +02:00
|
|
|
|
CheckFor mount "--version"
|
2021-08-24 21:20:33 +02:00
|
|
|
|
CheckFor nice "--version"
|
|
|
|
|
CheckFor nroff "--version"
|
2021-08-02 08:39:17 +02:00
|
|
|
|
CheckFor nslookup ""
|
|
|
|
|
CheckFor openssl ""
|
2021-08-24 21:20:33 +02:00
|
|
|
|
CheckFor perl "--version"
|
|
|
|
|
CheckFor ping "-V"
|
|
|
|
|
CheckFor ping6 "-V"
|
2022-01-07 13:30:23 +01:00
|
|
|
|
CheckFor powercfg "/?"
|
2021-11-30 10:34:53 +01:00
|
|
|
|
CheckFor powershell "--version"
|
2021-08-24 21:20:33 +02:00
|
|
|
|
CheckFor print ""
|
2021-07-26 20:09:48 +02:00
|
|
|
|
CheckFor printf "--version"
|
2021-08-26 15:47:55 +02:00
|
|
|
|
CheckFor python "--version"
|
|
|
|
|
CheckFor python3 "--version"
|
2021-12-07 11:27:25 +01:00
|
|
|
|
CheckFor rasdial "--version"
|
2021-07-26 20:09:48 +02:00
|
|
|
|
CheckFor regedit "--version"
|
|
|
|
|
CheckFor replace "--version"
|
|
|
|
|
CheckFor robocopy "--version"
|
2021-08-24 21:20:33 +02:00
|
|
|
|
CheckFor rsh ""
|
|
|
|
|
CheckFor rsync "--version"
|
2021-07-26 20:09:48 +02:00
|
|
|
|
CheckFor rundll32 "--version"
|
2021-08-24 21:20:33 +02:00
|
|
|
|
CheckFor scp ""
|
|
|
|
|
CheckFor sftp ""
|
2021-07-26 20:09:48 +02:00
|
|
|
|
CheckFor sha1sum "--version"
|
|
|
|
|
CheckFor sha256sum "--version"
|
|
|
|
|
CheckFor sha512sum "--version"
|
2021-08-24 21:20:33 +02:00
|
|
|
|
CheckFor ssh ""
|
2021-08-02 08:39:17 +02:00
|
|
|
|
CheckFor ssh-keygen ""
|
2021-08-24 21:20:33 +02:00
|
|
|
|
CheckFor sort "--version"
|
|
|
|
|
CheckFor split "--version"
|
|
|
|
|
CheckFor strace "--version"
|
2021-07-26 20:09:48 +02:00
|
|
|
|
CheckFor strings "--version"
|
2021-08-24 21:20:33 +02:00
|
|
|
|
CheckFor strip "--version"
|
|
|
|
|
CheckFor sudo "--version"
|
2021-08-02 15:51:01 +02:00
|
|
|
|
CheckFor systeminfo ""
|
2021-08-24 21:20:33 +02:00
|
|
|
|
CheckFor tail "--version"
|
|
|
|
|
CheckFor tar "--version"
|
2021-08-02 15:51:01 +02:00
|
|
|
|
CheckFor taskkill ""
|
|
|
|
|
CheckFor tasklist ""
|
2021-08-24 21:20:33 +02:00
|
|
|
|
CheckFor tee "--version"
|
|
|
|
|
CheckFor time ""
|
2021-08-02 15:51:01 +02:00
|
|
|
|
CheckFor timeout ""
|
2021-08-24 21:20:33 +02:00
|
|
|
|
CheckFor top "-v"
|
2021-08-02 15:51:01 +02:00
|
|
|
|
CheckFor tskill ""
|
2021-11-25 17:05:34 +01:00
|
|
|
|
CheckFor typeperf ""
|
2021-07-26 20:09:48 +02:00
|
|
|
|
CheckFor tzsync "--version"
|
2021-08-24 21:20:33 +02:00
|
|
|
|
CheckFor uniq "--version"
|
|
|
|
|
CheckFor vi "--version"
|
|
|
|
|
CheckFor vim "--version"
|
2021-07-26 20:09:48 +02:00
|
|
|
|
CheckFor vulkaninfo "--version"
|
|
|
|
|
CheckFor waitfor "--version"
|
2021-08-02 08:39:17 +02:00
|
|
|
|
CheckFor wakeonlan ""
|
2021-08-24 21:20:33 +02:00
|
|
|
|
CheckFor wget "--version"
|
|
|
|
|
CheckFor where "--version"
|
2021-07-26 20:09:48 +02:00
|
|
|
|
CheckFor whatis "--version"
|
2021-08-24 21:20:33 +02:00
|
|
|
|
CheckFor which ""
|
2021-12-01 08:13:00 +01:00
|
|
|
|
CheckFor winget "--version"
|
2021-07-26 20:09:48 +02:00
|
|
|
|
CheckFor whoami "--version"
|
2021-08-24 21:20:33 +02:00
|
|
|
|
CheckFor wput "--version"
|
|
|
|
|
CheckFor write ""
|
2021-09-02 13:09:35 +02:00
|
|
|
|
CheckFor wsl "--version"
|
2021-08-24 21:20:33 +02:00
|
|
|
|
CheckFor xcopy "--version"
|
|
|
|
|
CheckFor yes "--version"
|
|
|
|
|
CheckFor zip "--version"
|
2021-07-26 20:09:48 +02:00
|
|
|
|
CheckFor zipcloak "--version"
|
2021-08-02 08:39:17 +02:00
|
|
|
|
CheckFor zipdetails ""
|
|
|
|
|
CheckFor zipgrep ""
|
|
|
|
|
CheckFor zipinfo ""
|
|
|
|
|
CheckFor zipnote ""
|
|
|
|
|
CheckFor zipsplit ""
|
2021-08-24 21:20:33 +02:00
|
|
|
|
CheckFor zsh "--version"
|
2021-07-22 10:49:42 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
2021-12-01 08:13:00 +01:00
|
|
|
|
ListTools | format-table -property @{e='Name';width=12},@{e='Version';width=15},@{e='Location';width=55},@{e='FileSize';width=10}
|
2021-09-27 10:09:45 +02:00
|
|
|
|
exit 0 # success
|
2021-07-22 10:49:42 +02:00
|
|
|
|
} catch {
|
2021-09-16 20:19:10 +02:00
|
|
|
|
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
2021-07-22 10:49:42 +02:00
|
|
|
|
exit 1
|
|
|
|
|
}
|