You can use the .NET SDK in PowerShell to retrieve the helper classes that you will need to encrypt the credentials for your on-prem data source. Once you have encrypted your credentials you can use the Update Datasource endpoint in the Gateways API to update the credentials on your Gateway data source.