deleting mapped drives in .vbs that are mapped with .bat
Im new here...
We have moved our scripts to .vbs as we were running .bat log ons, so now when the scripts run, we get this drive is already in use. The only way to get rid of this is to delete the local profile on the computer, but with over 1000 clients we dont want to do that so..... is there any way that we can put in the first part of the vbscript a script that will automatically delete these mapped drives that are stored on the local computer???
This is what is running now... and we get the error this drive is already in use
Const Pupils = "cn=pupils"
set wshNetwork = CreateObject("WScript.Network")
Set ADSysInfo = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName)
strGroups = LCase(Join(CurrentUser.MemberOf))
If InStr(strGroups,pupils) Then
ive aslo got this
These are supposed to delete the drives, but it doesnt work...
' This will remove the mapped drive sDriveLetter
CreateObject("WScript.Shell").Run "net.exe use " _ & sDriveLetter & " /delete", 0, True
Dim objShell, objNetwork, DriveLetter1
DriveLetter1 = "P:"
Set objShell = CreateObject("WScript.Shell")
Set objNetwork = CreateObject("WScript.Network")
Re: deleting mapped drives in .vbs that are mapped with .bat
thanks for the reply....
Ive looked at the microsoft site and used this one
Set objNetwork = WScript.CreateObject("Wscript.Network")
now, it says it has disconnected the drive, but since the drive has been mapped on the local computer with the .bat logon using the command net use l: "....." it is still present and when i double click on the so called disconnected drive it connects again.
Does the scirpt in green above delete the local profile of the user and then creates it again, thats what im looking to do