Mapping Drives Permanently 
Author Message
 Mapping Drives Permanently

Quick Question, I have searched around, but can't seem to find the answer.

I have a script that unmaps the old network drives, and maps them to a new
server. Same dir's just different server name. We want this new drive
mapping to be permanent, but whenever I reboot, the old mapping shows up
again. We do not want the script to be run every time, just a run once on
each machine, and then discard.

Here is what I have.

Set oNet = CreateObject ("Wscript.Network")
oNet.RemoveNetworkDrive "G:"
oNet.RemoveNetworkDrive "H:"
oNet.RemoveNetworkDrive "I:"
oNet.MapNetworkDrive "G:" "\\NewServer\Dir1"
oNet.MapNetworkDrive "H:" "\\NewServer\Dir2"
oNet.MapNetworkDrive "I:" "\\NewServer\Dir3"

From what I can understand about the little bit I do understand, what this
does (I patched it together from bits and pieces I found, sorry if I have
plagiarized anyone, but it is the best way to learn). is removes the prior
drive mappings, and then connects to the new mappings, but when I reboot,
the old mappings remain & I need them to be permanent. I did see one script
that had a ,true,, kinda thing after the MapNetworkDrive but I could not get
it to work.
As well, is there an errorlevel or somesuch as some of the computers have a
J directory that we want unmapped permanently, but when I run it on a
machine that does not have the J mapped, it spits out an error and stops.
Thank you ever so much in advance for any help you may give.
BTW all Machines running Win98Se, with WSH 5.6



Sun, 31 Jul 2005 11:14:51 GMT  
 Mapping Drives Permanently



Quote:
> Quick Question, I have searched around, but

can't seem to find the answer.
Quote:

> .... We want this new drive
> mapping to be permanent, but whenever I reboot,

the old mapping shows up
Quote:
> again.
> oNet.RemoveNetworkDrive "G:"
> oNet.MapNetworkDrive "G:" "\\NewServer\Dir1"
> .. I did see one script
> that had a ,true,, kinda thing after the

MapNetworkDrive but...

Hi Kevin,

Try oNet.MapNetworkDrive "G:", "\\NewServer\Dir1",
True
with the commas

It's in the documentation
http://msdn.microsoft.com/downloads/sample.asp?url=/MSDN-FILES/027/00...

Karl



Sun, 31 Jul 2005 10:26:56 GMT  
 Mapping Drives Permanently
Thank you Karl.
I think it was just one of those I was looking in all the wrong places for
the answer. Appreciate the URL, tried to find some on the microsoft site
before, but I never thought to look in the MSDN section.
Off I go to learn.  Cya's around.


Quote:



> > Quick Question, I have searched around, but
> can't seem to find the answer.

> > .... We want this new drive
> > mapping to be permanent, but whenever I reboot,
> the old mapping shows up
> > again.
> > oNet.RemoveNetworkDrive "G:"
> > oNet.MapNetworkDrive "G:" "\\NewServer\Dir1"
> > .. I did see one script
> > that had a ,true,, kinda thing after the
> MapNetworkDrive but...

> Hi Kevin,

> Try oNet.MapNetworkDrive "G:", "\\NewServer\Dir1",
> True
> with the commas

> It's in the documentation

http://msdn.microsoft.com/downloads/sample.asp?url=/MSDN-FILES/027/00...
sdncompositedoc.xml

- Show quoted text -

Quote:

> Karl



Sun, 31 Jul 2005 14:40:25 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Permanently Map Network Drive

2. How do I map a drive that has already been mapped

3. get drive size from network network mapped drives

4. Cant remove Drive Mapped in VBScript

5. Mapping Drives

6. Group Drive Mappings

7. map drive per global group

8. Removing Mapped Drives

9. Map/unmap a drive?

10. Network Drive mapping?

11. Drive mapping

12. Drive Mapping

 

 
Powered by phpBB® Forum Software