mycon.Open ("{servername}", "{domain},{user},{password}")
How can we achieve this dynamically without hardcoding the username password?
If you want to dynamically pickup the credentials, then simply connect using
myCon.Open ("{servername}")
This function is overloaded, and by simply specifying only the server name, it will automatically pickup the user's context (as long as anonymous access is turned off for the site), and the process can be planned without hardcoding the username.