|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Delete and map network drive using VB script
I wrote the following script to delete and map network drive. What I actullay
want is to delete if the drive is mapped and map using the VP script, and also to map the drive if the drive is not mapped. Please check this script if it can accomplish my goal. The way the network drives were mapped is using the bat file, now I would like to change it to VB script....Thanks Set objNetwork = CreateObject("WScript.Network") objnetwork.RemoveNetworkDrive "M:" objNetwork.MapNetworkDrive "M:" , "\\Fileserv01\Test1" Try the MapDrive function in the attached file.
Show quote "Lino767" <Lino***@discussions.microsoft.com> wrote in message news:231C2206-04E5-4AF8-BA0F-505A3B5FD4E1@microsoft.com... >I wrote the following script to delete and map network drive. What I >actullay > want is to delete if the drive is mapped and map using the VP script, and > also to map the drive if the drive is not mapped. Please check this script > if > it can accomplish my goal. The way the network drives were mapped is using > the bat file, now I would like to change it to VB script....Thanks > > Set objNetwork = CreateObject("WScript.Network") > objnetwork.RemoveNetworkDrive "M:" > objNetwork.MapNetworkDrive "M:" , "\\Fileserv01\Test1" Sorry, I forgot to remove all the lines that start with TraceOutput, either
remove them or add some kind of debug sub-routine to the script: Sub TraceOutput(ByVal strMessage) 'Echo or write strMessage here. End Sub Show quote "Marty List" <use***@optimumx.com> wrote in message news:7D6D019B-EB26-4491-9C65-180DDA076438@microsoft.com... > > Try the MapDrive function in the attached file. > > > > "Lino767" <Lino***@discussions.microsoft.com> wrote in message > news:231C2206-04E5-4AF8-BA0F-505A3B5FD4E1@microsoft.com... >>I wrote the following script to delete and map network drive. What I >>actullay >> want is to delete if the drive is mapped and map using the VP script, and >> also to map the drive if the drive is not mapped. Please check this >> script >> if >> it can accomplish my goal. The way the network drives were mapped is >> using >> the bat file, now I would like to change it to VB script....Thanks >> >> Set objNetwork = CreateObject("WScript.Network") >> objnetwork.RemoveNetworkDrive "M:" >> objNetwork.MapNetworkDrive "M:" , "\\Fileserv01\Test1" > |
|||||||||||||||||||||||