-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgpg-ssh-setup.ps1
More file actions
23 lines (20 loc) 路 948 Bytes
/
Copy pathgpg-ssh-setup.ps1
File metadata and controls
23 lines (20 loc) 路 948 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function Setup-GpgSsh {
$gpgConnect = Get-Command gpg-connect-agent -ErrorAction SilentlyContinue
if (-not $gpgConnect) {
Write-Warning "gpg-connect-agent not found - is Gpg4win installed?"
return
}
# Create gpg-connect-agent startup shortcut (starts gpg-agent on login)
$startup = "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Startup"
$shell = New-Object -ComObject WScript.Shell
$lnk = $shell.CreateShortcut("$startup\gpg-connect-agent.lnk")
$lnk.TargetPath = $gpgConnect.Source
$lnk.Arguments = "/bye"
$lnk.Save()
Write-Host "[OK] gpg-connect-agent startup shortcut created" -ForegroundColor Green
# Start agent now for current session
gpg-connect-agent /bye 2>$null | Out-Null
Write-Host "[OK] gpg-agent started" -ForegroundColor Green
Write-Host "`nVerify SSH keys with: ssh-add -L" -ForegroundColor Cyan
}
Set-Alias -Name setup-gpg-ssh -Value Setup-GpgSsh