Can you embed the private key into a PowerShell WinSCP script instead of calling for the .ppk file? Maybe something like this?
# Load WinSCP .NET assembly
Add-Type -Path "WinSCPnet.dll"
# Set up session options
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
Protocol = [WinSCP.Protocol]::Scp
HostName = "domain.com"
UserName = "username"
SshHostKeyFingerprint = "ssh-rsa 2048 38741934871934871293471293487"
SecurePrivateKeyPassphrase = "AAABAHH1......................"
}
$session = New-Object WinSCP.Session
try
{
# Connect
$session.Open($sessionOptions)
# Your code
}
finally
{
$session.Dispose()
}