I stole this code for a project which generates and runs .RDP files: windows encrypted rdp passwords in golang
The project writes an RDP file, runs it then deletes it