MySQL, SQL server

runas command.

One of the problems with multiple environments (production/staging/uat/dev/test) for a given application is the many different logins that are used. I had created an application in test and wanted to copy those files from test to statging using the UNC file name (using SMB). Since the logins were different on test and staging, I could not simply give the UNC of the staging server to allow me to drag and drop my files. This is where the runas comes in. You can use runas on a server and use a different login to launch a give application.

I could log into my test server as test\stan and then open up explorer as staging\stan. The command would be: runas.exe /user:staging\stan explorer.exe. This would normally work for exes, but for explorer, you have to add the /separate switch. So, the correct command would be: runas.exe /user:staging\stan "explorer.exe /separate". To be honest, I still had problems, and ended up mapping the drive as a network drive, but this trick works when launching SSMS as a different user. (Edit on April 13,2011) For running SSMS as another user, note that the user must be part of a group that has rights on the server. Putting the user as part of the administrator group will surely give the user the required privileges.


Thinking about someting? Leave a Reply...

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s