Associate
- Joined
- 4 Apr 2006
- Posts
- 171
- Location
- Hertfordshire
Hi All,
Im having a little trouble understanding why my script isnt working fully.
It doesnt say there is a problem running the script but it doesnt do what its supposed to.
This is what im using:
=======================================================
On Error Resume Next
Dim clDrives, wshNet
'Removing Mapped Drives
Set clDRives = WshNetwork.EnumNetworkDRives
For i = 0 to clDrives.Count -1 Step 2
wshNet.RemoveNetworkDrive clDrive.Item(i), Ture, True
Next
'Adding Mapped Drives
Set wshNet = CreateObject("wscript.Network")
wshNet.MapNetworkDrive "O:", "\\datasrv\data"
wshNet.MapNetworkDrive "T:", "\\mailsrv\users"
wshNet.MapNetworkDrive "S:", "\\mailsrv\data"
wscript.quit
=======================================================
Now it adds the Drive Mappings fine but when it look to see if its removed any i make extra it leaves them in disconnected state within My Computer and they are unaccessable, but I reassign the drive letter.
Is the code wrong or is it because im running the script just by opening from within windows. (i.e. I'm testing it before I set it as the actual script in Windows 2003 Active Directory)
Also I would like to add in to the script removing of network printers (especially the Auto ones in windows XP) and then adding some others. Leaving the local ones ofcourse. Any suggestions would be greatly appreciated!
Cheers Chaps!
Im having a little trouble understanding why my script isnt working fully.
It doesnt say there is a problem running the script but it doesnt do what its supposed to.
This is what im using:
=======================================================
On Error Resume Next
Dim clDrives, wshNet
'Removing Mapped Drives
Set clDRives = WshNetwork.EnumNetworkDRives
For i = 0 to clDrives.Count -1 Step 2
wshNet.RemoveNetworkDrive clDrive.Item(i), Ture, True
Next
'Adding Mapped Drives
Set wshNet = CreateObject("wscript.Network")
wshNet.MapNetworkDrive "O:", "\\datasrv\data"
wshNet.MapNetworkDrive "T:", "\\mailsrv\users"
wshNet.MapNetworkDrive "S:", "\\mailsrv\data"
wscript.quit
=======================================================
Now it adds the Drive Mappings fine but when it look to see if its removed any i make extra it leaves them in disconnected state within My Computer and they are unaccessable, but I reassign the drive letter.
Is the code wrong or is it because im running the script just by opening from within windows. (i.e. I'm testing it before I set it as the actual script in Windows 2003 Active Directory)
Also I would like to add in to the script removing of network printers (especially the Auto ones in windows XP) and then adding some others. Leaving the local ones ofcourse. Any suggestions would be greatly appreciated!
Cheers Chaps!
Last edited: