If you have an installation of SQL Server on non standard ports, from your code you can connect to it from your code using a standard connection string, but with the addition of creating a ODBC system connection pointing the same SQL Server, and assigning there the custom TCP port.
When you need to connect to SQL Server Management Studio, in the login form you need to use SERVER,PORT.
Are you a consultant in a company, need to read/write the ActiveDirectory of your client, but you are usign your own laptop, witch is outside the domian?
I have found a solution to run the dsa.msc applet running in a computer outside the domain:
runas /netonly /user:DOMAIN\USER "mmc dsa.msc /domain=FQN_DOMAIN"