Updated list-cli-tools.ps1 and list-network-neighbors.ps1

This commit is contained in:
Markus Fleschutz 2024-05-09 11:29:07 +02:00
parent 3b3f8db539
commit af92a2972d
2 changed files with 17 additions and 11 deletions

View File

@ -6,9 +6,9 @@
.EXAMPLE
PS> ./list-cli-tools.ps1
CLI-Tool Version Location
-------- ------- --------
at 10.0.19041.1 C:\WINDOWS\system32\at.exe (31K)
Tool Name Version Installation Path
--------- ------- -----------------
7z 23.01 /usr/bin/7z (38 bytes)
...
.LINK
https://github.com/fleschutz/PowerShell
@ -53,13 +53,13 @@ function ListTool([string]$Name, [string]$VersionArg) {
} else {
$Size = 0
}
New-Object PSObject -Property @{ 'CLI-Tool'=$Name; Version=$Version; Location="$Path ($(Bytes2String $Size))" }
New-Object PSObject -Property @{ 'Tool Name'=$Name; 'Version'=$Version; 'Installation Path'="$Path ($(Bytes2String $Size))" }
} catch {
return
}
}
function ListTools {
function ListTools {
ListTool 7z "-version"
ListTool ant "-v"
ListTool apt "--version"
@ -70,7 +70,7 @@ function ListTools {
ListTool ar "--version"
ListTool arch "--version"
ListTool arecord "--version"
ListTool arp ""
ListTool arp "--version"
ListTool at ""
ListTool attrib ""
ListTool auditpol ""
@ -201,6 +201,7 @@ function ListTools {
ListTool icacls "--version"
ListTool iconv "--version"
ListTool id "--version"
ListTool ip "help"
ListTool ipfs "--version"
ListTool java "--version"
ListTool jcli "version"
@ -235,6 +236,7 @@ function ListTools {
ListTool netsh ""
ListTool netstat ""
ListTool nice "--version"
ListTool nmap "--version"
ListTool nohup "--version"
ListTool nroff "--version"
ListTool nslookup ""
@ -328,7 +330,7 @@ function ListTools {
}
try {
ListTools | Format-Table -property @{e='CLI-Tool';width=14},@{e='Version';width=17},@{e='Location';width=90}
ListTools | Format-Table -property @{e='Tool Name';width=15},@{e='Version';width=15},@{e='Installation Path';width=90}
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,6 +1,6 @@
<#
.SYNOPSIS
Lists the (cached) network neighborspwd
Lists the (cached) network neighbors
.DESCRIPTION
This PowerShell script lists all cached network neighbors of the local computer.
.EXAMPLE
@ -17,9 +17,13 @@
#>
try {
if ($IsLinux -or $IsMacOS) { throw "Sorry, currently available for Windows only" }
Get-NetNeighbor -includeAllCompartments | Format-Table -property Name,InterfaceAlias,IPAddress,LinkLayerAddress,State -autoSize
if ($IsLinux) {
& ip neigh
} elseif ($IsMacOS) {
& ip neigh
} else {
Get-NetNeighbor -includeAllCompartments | Format-Table -property InterfaceAlias,IPAddress,LinkLayerAddress,State -autoSize
}
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"