I’m writing a script to add VPN connection on Windows 10. When I run the script, PowerShell asks “Transmitting the secret key over unsecure text stream… Do you want to continue?”

I know I can enter -Force to stop the message, but is there a better way? How can I transmit it securely via PowerShell?

Never used VPN cmdlets, but from docs, I think -EncryptionLevel will do it, You can wait for more comments from others.