Using the netonly switch

The company I currently work for keeps all of their environments in separate domains. Not an uncommon scenario, so OK, we can work with it. However, the challenge has always been how to have a shared database development location that everyone can use without remoting over to the machine. The problem with that is handling multiple people. It works fine until you reach a predetermined number of developers (2). Since the development machines are in a different domain, simply right-clicking, selecting runas, and passing new credentials doesn’t work. The answer, as with most things, lies in a simple change. It’s called netonly, and it’s extremely handy.

To use it, open up notepad, type in the code, and then save it as a batch file.  Then you can authenticate across! I use this regularly to connect across the domain to our servers in our development domain while staying on my local machine. DOMAIN\username is the domain\username that you want to pass in.

runas /netonly /user:DOMAIN\username  “Program File Path”

For example, for SQL Server Management Studio 2008 R2 the file path would be below (on 32 bit windows xp, don’t ask :)):

runas /netonly /user:DOMAIN\username “C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\ssms.exe”

NOW we’re getting somewhere. Next point is what if you want to pass the DOMAIN\username in as a variable(so you can pass this awesome new tool you found around to everyone in your shop)?

Again, the answer is just a quick change to our code.

@echo off

set /p user=”Username: ”

runas /netonly /user:%user% “C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe”

Now we can take this and use to authenticate quickly and easily across domains using the credentials we want, even when crossing to a different domain.


Hope it helps you in your travels.


One more quick note: This is my first blog post, so feedback is appreciated. 🙂


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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s