THE SQL Server Blog Spot on the Web

Welcome to - The SQL Server blog spot on the web Sign in | |
in Search

Davide Mauri

A place for my thoughts and experiences the Microsoft Data Platform

Running and application with a domain user even if you’re not in a domain.

I just discovered yesterday the possibility to run an application under the credential of a domain user, even if you’re not in a domain. This is a very useful feature for me: being a consultant I work with a lot of different customers, each one with its own domain, and each one (of course) with a different user account for myself.

I cannot join all their domains so I have to work outside the domain, or I have to create a Virtual Machine with all the tools I need and then join their domain. This, unfortunately, means a lot of installation and maintenance work.

But what I discovered yesterday simply changed my life Smile: to execute an application using a domain user, even if you’re not I a domain, all you have to do is to use the /netonly option of the runas command!

To launch Excel, for example:

runas /netonly /user:THEDOMAIN\theuser "C:\Program Files (x86)\Microsoft Office\Office14\EXCEL.EXE"

And that’s it! Now you can browse the cubes on SSAS (for example) using the software on your machine. Cool!

Published Thursday, August 18, 2011 11:45 AM by Davide Mauri
Filed under: ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS



GS said:

The only problem with that approach that it can not be used for automation etc since you can not specify password in this statement and hence can not be part of batch file or anything similar in nature.

August 20, 2011 11:50 PM

JH said:

If you use Start/Run with:

C:\WINDOWS\system32\rundll32.exe keymgr.dll, KRShowKeyMgr

(changing C:\Windows as needed) you can store a user name with domain and password for a specific computer/server. When you connect to that computer windows will then use these credentials in preference to the credentials you have used to log in to the computer you are on. Beware this does save them so make sure your own computer is secure - but this does allow the automation GS desires

August 22, 2011 4:39 AM

Tony said:

A colleage of mine Rob pointed this out. I can't believe this really useful capability has been there and I didn't come across it. Thank you very much for this. This will really make a difference to me - for running my desktop tools within the context of another domain.

Tony S.

August 22, 2011 4:55 AM

Davide Mauri said:

JH: Cool! I'll try it ASAP! Thanks for sharing!

August 22, 2011 5:01 AM

Davide Mauri said:

Tony: You're welcome! :)

August 22, 2011 8:13 AM

JH said:

BTW - seeing as this is a SQL blog you might want to know my tip allows you to access SQL servers using normal SQL "Windows authorization" connections across to other domains too

August 22, 2011 1:04 PM

Mike B said:

Yes. I was very overjoyed when I found this trick.

August 25, 2011 12:52 AM

Leave a Comment


About Davide Mauri

Director of Software Development & Cloud Infrastructure @ Sensoria, an innovative smart garments and wearable company. After more than 15 year playing with the Microsoft Data Platform, with a specific focus on High Performance databases, Business Intelligence, Data Science and Data Architectures, he's now applying all his skills to IoT, defining architectures to crunch numbers, create nice user experiences and provide meaningful insights, all leveraging Microsoft Azure cloud. MVP on Data Platform since 2006 he has a very strong background development and love both the ER model and OO principles. He is also a fan of Agile Methodology and Automation, which he tries to apply everywhere he can, to make sure that "people think, machines do".

This Blog


Privacy Statement