mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-16 17:51:28 +01:00
Added list-ssh-key.ps1
This commit is contained in:
parent
4f247ce328
commit
3fcbbeb8b0
@ -17,9 +17,10 @@
|
||||
|
||||
Write-Host "`n N E T W O R K" -foregroundColor green
|
||||
& "$PSScriptRoot/list-ip-addresses.ps1"
|
||||
& "$PSScriptRoot/list-ssh-key.ps1"
|
||||
& "$PSScriptRoot/ping-remote-hosts.ps1"
|
||||
& "$PSScriptRoot/check-firewall"
|
||||
& "$PSScriptRoot/check-dns.ps1"
|
||||
& "$PSScriptRoot/check-vpn.ps1"
|
||||
& "$PSScriptRoot/ping-local-hosts.ps1"
|
||||
exit 0 # success
|
||||
exit 0 # success
|
||||
|
28
scripts/list-ssh-key.ps1
Executable file
28
scripts/list-ssh-key.ps1
Executable file
@ -0,0 +1,28 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Lists the SSH key
|
||||
.DESCRIPTION
|
||||
This PowerShell script lists the user's public SSH key.
|
||||
.EXAMPLE
|
||||
PS> ./list-ssh-key.ps1
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
if (Test-Path "~/.ssh/id_ed25519.pub") {
|
||||
$key = Get-Content "~/.ssh/id_ed25519.pub"
|
||||
"✅ Public SSH key is: $key"
|
||||
} elseif (Test-Path "~/.ssh/id_rsa.pub") {
|
||||
$key = Get-Content "~/.ssh/id_rsa.pub"
|
||||
"✅ Public SSH key is: $key"
|
||||
} else {
|
||||
"⚠️ No SSH key found"
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
Loading…
Reference in New Issue
Block a user