Pages

Thursday, August 27, 2009

How to add a DNS suffix from a command prompt

We recently moved our datacenter, which involved adding our servers to our new domain and related DNS server (let's call it mydomain.com).  Previously, users connected to a telnet server by hostname (let's call it server1).  Well, after moving our datacenter, users could no longer connect to the server unless they used its FQDN of server1.mydomain.com. 

At this point we knew we'd have to hit every single computer (hundreds) on our network to update their preset connections.  We had an option -- we could either join each machine to the domain, or we could add a DNS suffix of mydomain.com to their local area connection tcp/ip properties.  We opted for the latter, since joining each machine to the domain would take longer, and is unnecessary considering we're in the process of rolling out thin clients to replace each of these machines.

In order to add a DNS suffix to a TCP/IP connection remotely, all you need is a list of IP addresses and the following command:
wmic /USER:administrator /PASSWORD:adminpassword /node:@c:\iplist.txt nicconfig call SetDNSSuffixSearchOrder (mydomain.com)

Where C:\iplist.txt contains a list of IP addresses, line separated.

After running this command for all of the IP addresses, users could then resolve server1 without needing to type out the whole FQDN.  Of course, this command could also be put in a script if you wanted to use it in such a way as well. 

Happy Networking!

Monday, August 10, 2009

How to "forget" network share credentials so you can authenticate as another user

UPDATE (10/26/09): I recently stumbled across a case where I was getting the "multiple connections" error and the steps below did not resolve the issue. There is one more place to look (especially if you checked the box to "Remember my password" when connecting to the network share) to remove stored credentials. Go to Control Panel -> User Accounts. Then go to the Advanced tab and under "Passwords and .NET Passports" click on "Manage Passwords". If the server you're trying to connect to is listed there, you're in luck. Simply remove the entry, and log off and then back in again. You should then be prompted for your new credentials.

This is something that has saved me a lot of time by removing the need to log out from my current Windows session. Have you ever connected to a network share and then wanted to authenticate as another user and received the following error:
"Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed."?

For the longest time, I thought the solution was to log out and then back in again to authenticate as the other user. It turns out there is a much easier way to get your computer to "forget" your current credentials so that you can use alternative ones. Simply bring up a command prompt and type:
net use * /d /y
This will effectively disconnect all remote connections as well as their associated credentials.
If you have more than one network connection open and you'd rather just delete a specific connection, type in:
net use
in a command prompt window. This will list all of your current remote connections. To delete a specific connection (let's say to \\server\share), type in the following in the command prompt:
net use \\server\share /d /y

If you're more of a GUI fan, you can go to My Computer and then select:
Tools -> Disconnect Network Drive
Then just select the specific connection that you'd like to disconnect and click the OK button.

I hope that this saves you some time!