Encrypting To create a DPAPI-encrypted environment variable run the following PowerShell: [Environment]::SetEnvironmentVariable((Read-Host "Enter name"), (Read-Host "Enter value" -AsSecureString | ConvertFrom-SecureString), 'User') And follow the prompts: