Getting Error Running Script

G

Guest

Hi.
I am getting an error running a script on Win XP Pro SP2.
The script attempts to map a network drive ---

Option Explicit
Dim fServer
Dim fpublic
Dim wshNet

fServer = "\\corp-group"
fpublic = "\ati"
Set wshNet = CreateObject("WScript.Network")
wshNet.MapNetworkDrive "h:", fServer & fpublic , "ati", "tigers8874"

This results in the following error:

---------------------------
Windows Script Host
---------------------------
Script: C:\conndir.vbs
Line: 9
Char: 1
Error: Type mismatch.

Code: 80020005
Source: WSHNetwork.MapNetworkDrive
 
S

Samsung

Looks like it should work, you sure there are no changes here?

You might want to change ati's password from "tigers8874" to something else
though, now that you have posted it all over the internet.

However, to answer your question, I would try posting this to a visual basic
newsgroup, you will likely get a better response. From what I see however,
it looks okay in the XP realm of things. A mismatch error usually indicates
something with the script.
 
S

Samsung

Here is a copy of the script I use:

Set wshNetwork = CreateObject("WScript.Network")
WSHNetwork.MapNetworkDrive "f:", "\\SomeServer\SomePath\Here"

I believe only these two lines are absolutely necessary. If I recall my
Visual Basic correctly, the "Option Explicit" command at the top makes it so
that all that "Dim thisandthat" is necessary, but if you use just these two
lines only and exclude the "Option Explicit" and everything else, it should
still work fine.

btw, you may want to replace the "\\SomeSever\SomePath\Here" part with
something else, like "\\corp-group\ati".

thus,

Set wshNetwork = CreateObject("WScript.Network")
WSHNetwork.MapNetworkDrive "f:", "\\corp-group\ati"
 
R

Ramesh, MS-MVP

David,

This is because that a parameter is missing.

wshNet.MapNetworkDrive "h:", fServer & fpublic , "ati", "tigers8874"

should be:

wshNet.MapNetworkDrive "h:", fServer & fpublic , ,"ati", "tigers8874"


MapNetworkDrive - MSDN Library
=========================

bUpdateProfileOptional.
If bUpdateProfile is supplied and its value is TRUE, the mapping is stored
in the user profile. The default is FALSE.

MSDN Library Archive:
http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/wsh/htm/wsMthMapNetworkDrive.asp

--
Regards,

Ramesh Srinivasan, Microsoft MVP [Windows XP Shell/User]
Windows® XP Troubleshooting http://www.winhelponline.com


message Hi.
I am getting an error running a script on Win XP Pro SP2.
The script attempts to map a network drive ---

Option Explicit
Dim fServer
Dim fpublic
Dim wshNet

fServer = "\\corp-group"
fpublic = "\ati"
Set wshNet = CreateObject("WScript.Network")
wshNet.MapNetworkDrive "h:", fServer & fpublic , "ati", "tigers8874"

This results in the following error:

---------------------------
Windows Script Host
---------------------------
Script: C:\conndir.vbs
Line: 9
Char: 1
Error: Type mismatch.

Code: 80020005
Source: WSHNetwork.MapNetworkDrive
 
G

Guest

I did not see that was missing! I had to change the line from the original
code and missed the parameter setting. Thanks!
 
R

Ramesh, MS-MVP

YW David.

--
Regards,

Ramesh Srinivasan, Microsoft MVP [Windows XP Shell/User]
Windows® XP Troubleshooting http://www.winhelponline.com


message I did not see that was missing! I had to change the line from the original
code and missed the parameter setting. Thanks!
 
G

Guest

If the corp-group actually existed and ati was a user then i would agree with
you. I always make sure to change things up enough that I am protected.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top