Skip to content

List-SshKey

List the public SSH key

try {
	if (Test-Path "~/.ssh/id_ed25519.pub") {
		$key = Get-Content "~/.ssh/id_ed25519.pub"
	} elseif (Test-Path "~/.ssh/id_rsa.pub") {
		$key = Get-Content "~/.ssh/id_rsa.pub"	
	} else {
		throw "No public SSH key found - execute 'new-ssh-key.ps1' to create one"
	}
	Write-Host "? Public SSH key is: $key"
	exit 0 # success
} catch {
	"?? ERROR: $($Error[0])"
	exit 1
}

This script has no configurable parameters.

An interactive directory of PowerShell scripts.