Flushing the DNS cache from the login script.

At the office where I work are three servers. When a user logs onto the network, a login script runs and maps some network drives to shared folders across all three servers. However, there is one server on which the mapped drives don’t always appear. I came up with a fix for this problem but its effects seem temporary and wear off for reasons I’m still trying to fathom. What I do is drop to a command prompt and type:

ipconfig /flushdns

Afterwards I re-run the login script for that user and the missing drives magically re-appear.
To save even more time, I’ve added two lines at the beginning of the login script that flush the DNS cache before the network drives are mapped.

Set objShell = Wscript.CreateObject(“Wscript.Shell”)
objShell.run(“%comspec% /c ipconfig /flushdns”)

When the script is run, a DOS window will briefly flash on the screen as the DNS cache is flushed, allowing me to continue investigating the drive mapping puzzle undisturbed.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com 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