Question : script will not removed mapped drive from user profiles

I have a logon script group policy on a win2k3 sp2 server that maps several drives on the users roaming profile.   I tried to update the logon script to remove the map drive, but it does not. please help.

WSHNetwork.RemoveNetworkDrive "X:", "\\LICSRV\EFILES", True, True

I also tried this command as well:

WSHNetwork.RemoveNetworkDrive "X:"


Answer : script will not removed mapped drive from user profiles

Here's your script modified
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
ON ERROR RESUME NEXT

Set WSHShell = CreateObject("WScript.Shell")
Set WSHNetwork = CreateObject("WScript.Network")
DomainString = "DomainName"
UserString = WSHNetwork.UserName

Set UserObj = GetObject("WinNT://" & DomainString & "/" & UserString)

'Synchronizes the time with Server our NTP Server
WSHShell.Run "NET TIME \\LICSRV /set /y"
WSHShell.Run "NETLOGON DST-Update.bat"

' remove drives
DIM objNetwork,colDrives,i

Set objNetwork = CreateObject("Wscript.Network")

Set colDrives = objNetwork.EnumNetworkDrives

For i = 0 to colDrives.Count-1 Step 2
     ' Force Removal of network drive and remove from user profile
      ' objNetwork.RemoveNetworkDrive strName, [bForce], [bUpdateProfile]
     objNetwork.RemoveNetworkDrive colDrives.Item(i),TRUE,TRUE
Next



wscript.sleep 300

'Maps drives needed by all
WSHNetwork.MapNetworkDrive "F:", "\\LICSRV\DATA",True
WSHNetwork.MapNetworkDrive "Z:", "\\LICSRV\public",True
WSHNetwork.MapNetworkDrive "P:", "\\LICSRV\Premise",True
WSHNetwork.MapNetworkDrive "M:", "\\LICSRV\MED IQ",True
WSHNetwork.MapNetworkDrive "S:", "\\LICSRV\SCANS",True
WSHNetwork.MapNetworkDrive "L:", "\\LICSRV\LEGAL",True
WSHNetwork.MapNetworkDrive "w:", "\\NASLIC\NASpublic",True
WSHNetwork.MapNetworkDrive "V:", "\\NASLIC\NASefiles",True




'Now check for group memberships and map appropriate drives
For Each GroupObj In UserObj.Groups

Select Case GroupObj.Name
'Check for group memberships and take needed action
     Case "Admin"
       WSHNetwork.MapNetworkDrive "w:", "\\Server\Admin Stuff",True
     Case "WorkerB"
        WSHNetwork.MapNetworkDrive "w:", "\\Server\Shared Documents",True

End Select

Next

'Disconnect a network printer

WSHNetwork.RemovePrinterConnection "\\LICSRV\DP6030_BACK"

'Disconnect a network drive


'Install Printers

WSHNetwork.AddWindowsPrinterConnection "\\LICSRV\PRINTER1"
WSHNetwork.AddWindowsPrinterConnection "\\LICSRV\PRINTER2"
WSHNetwork.AddWindowsPrinterConnection "\\LICSRV\PRINTER3"
WSHNetwork.AddWindowsPrinterConnection "\\LICSRV\PRINTER4"
WSHNetwork.AddWindowsPrinterConnection "\\LICSRV\PRINTER5"
WSHNetwork.AddWindowsPrinterConnection "\\LICSRV\PRINTER6"
WSHNetwork.AddWindowsPrinterConnection "\\LICSRV\PRINTER8"
WSHNetwork.AddWindowsPrinterConnection "\\LICSRV\PRINTER9"
WSHNetwork.AddWindowsPrinterConnection "\\LICSRV\PRINTER10"
WSHNetwork.AddWindowsPrinterConnection "\\LICSRV\PRINTER7"
WSHNetwork.AddWindowsPrinterConnection "\\LICSRV\PRINTER11"
WSHNetwork.AddWindowsPrinterConnection "\\LICSRV\PRINTER12"
WSHNetwork.AddWindowsPrinterConnection "\\LICSRV\PRINTER13"
WSHNetwork.AddWindowsPrinterConnection "\\LICSRV\Zebra1"
WSHNetwork.AddWindowsPrinterConnection "\\LICSRV\DP-8060"
WSHNetwork.AddWindowsPrinterConnection "\\LICSRV\DP-6030"
WSHNetwork.AddWindowsPrinterConnection "\\LICSRV\DP-8060_NEW1"
WSHNetwork.AddWindowsPrinterConnection "\\LICSRV\DP-8060_NEW2"
WSHNetwork.AddWindowsPrinterConnection "\\LICSRV\DP6030_BACK"
WSHNetwork.AddWindowsPrinterConnection "\\LICSRV\TOSHIBA_COPIER"
WSHNetwork.AddWindowsPrinterConnection "\\LICSRV\ZEBRA2"
WSHNetwork.AddWindowsPrinterConnection "\\LICSRV\LANIER"
WSHNetwork.AddWindowsPrinterConnection "\\LICSRV\ZEBRA3"
WSHNetwork.AddWindowsPrinterConnection "\\LICSRV\DP-8060_NEW3"
WSHNetwork.AddWindowsPrinterConnection "\\LICSRV\TOSHIBA_eStudio603"
WSHNetwork.AddWindowsPrinterConnection "\\LICSRV\LANIER_FAX_LD320D"
WSHNetwork.AddWindowsPrinterConnection "\\LICSRV\DP6030_NEW1"
WSHNetwork.AddWindowsPrinterConnection "\\LICSRV\TOSHIBA_655NEW"
WSHNetwork.AddWindowsPrinterConnection "\\LICSRV\TOSHIBA_655NEW1"





set UserObj = Nothing
set GroupObj = Nothing
set WSHNetwork = Nothing
set DomainString = Nothing
set WSHSHell = Nothing

wscript.quit
Random Solutions  
 
programming4us programming4us