Windows XP and scripts for mapping network drives

  • Thread starter Thread starter cwebb
  • Start date Start date
C

cwebb

I have scripts wrote for mapping network drives and they work on all the
computers I have at my facility except two computers. One is running Windows
7 and the other is running windows XP SP3. If I change the script to using
an IP Address instead of the Server name it will work. I have Flushed the
DNS settings and reset all my IP settings. What else can I do to resolve
these issues. I have not yet tried restarting the server because I will have
to wait until all the users are not connected.
 
cwebb said:
I have scripts wrote for mapping network drives and they work on all the
computers I have at my facility except two computers. One is running
Windows 7 and the other is running windows XP SP3. If I change the script
to using an IP Address instead of the Server name it will work. I have
Flushed the DNS settings and reset all my IP settings. What else can I do
to resolve these issues. I have not yet tried restarting the server
because I will have to wait until all the users are not connected.

You say the script does not work.
- What commands do you use?
- What message(s) do you see?
- What happens when you issue the command(s) manually from a Command Prompt?
 
The Script does work on all the computer but two. There is no error message
with the script. It worked fine on 08/13/2010 but on 08/16/2010 stopped
working. I tried a different script in CMD and got a System Error 2221 did
a search on Google and found a solution for the Windows 7 PC. Here is the
link http://forums.techarena.in/server-dns/75255.htm post ID racingmustang I
have not tried it on the Windows XP PC yet I will let you know how it works
out. Seems Windows was holding on to some bad credentials.

Example:
Set wshNetwork = CreateObject( "WScript.Network" )
On Error Resume Next

With wshNetwork

wshNetwork.RemoveNetworkDrive "N:", True
wshnetwork.MapNetworkDrive "N:", "\\192.168.1.1\share"
If Err Then

End If

End With

On Error Goto 0
Set wshNetwork = Nothing
 
It is not surprising that you don't get any error messages since the script
explicitly suppresses them. Not good programming practice . . .

To start with I recommend that you open a command prompt and try this humble
command:

net use N: \\192.168.1.1\share

By the way, is there a strong reason why you use a VB Script rather than a
batch file? VB Scripting is a wonderful thing but when performing simple
tasks such as mapping a network drive it has two big drawbacks:
- Its code is invariably 3 . . 6 times larger than the equivalent batch
file, making it 3 . . 6 times harder to write and maintain and potentially
having 3 . . 6 times more bugs.
- Debugging a script file is a lot harder than debugging a batch file (which
is probably why you're here . . .)
 
Back
Top