$FunctionCode = @' function ssh-copy-id { param([Parameter(Mandatory=$true)][string]$RemoteTarget) $KeyPath = "$env:USERPROFILE\.ssh\id_ed25519.pub" if (!(Test-Path $KeyPath)) { Write-Error "Public key not found at $KeyPath" return } $PubKey = Get-Content $KeyPath ssh $RemoteTarget "mkdir -p ~/.ssh && chmod 700 ~/.ssh && echo '$PubKey' >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys" } '@ Add-Content -Path $PROFILE -Value $FunctionCode . $PROFILE