Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Citrix Remembering Old Drive Mappings

Status
Not open for further replies.

detroit

MIS
Sep 13, 2002
160
CA
OK, here's a weird one...

Moved all my files from \\fs1 to \\cfs

Changed all login scripts to use \\cfs instead.

In Citrix, mapped drives that used to be \\fs1\all are still \\fs1\all instead of \\cfs\all

Seems like they are cached somewhere in TSProfiles (Which is set in Active Directory)

Is there a way to clear these?
 
I map users drives based on Active Directory group membership (use same group name to publish application to that user).

It deletes all mapped drives, then readds after checking active directory for group membership (based on username).

You can use this by saving the following script to c:\windows\system32\map_drives.vbs adding the following line to your c:\system32\usrlogon.bat

wscript map_drives.vbs

=================================================

Set objNetwork = CreateObject("WScript.Network")
Set colDrives = objNetwork.EnumNetworkDrives
UserName = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%username%")

On Error Resume Next

For i = 0 to colDrives.Count-1 Step 2
objNetwork.RemoveNetworkDrive colDrives.Item(i)
Next


If IsMember("ActiveDirectoryGroupName1") = "True" Then
objNetwork.MapNetworkDrive "P:", "\\share\subfolder"
End If

If IsMember("ActiveDirectoryGroupName2") = "True" Then
objNetwork.MapNetworkDrive "L:", "\\share\subfolder"
End If

If IsMember("ActiveDirectoryGroupName3") = "True" Then
objNetwork.MapNetworkDrive "N:", "\\share\subfolder"
End If

If IsMember("ActiveDirectoryGroupName4") = "True" Then
objNetwork.MapNetworkDrive "M:", "\\share\subfolder"
End If

' This function checks to see if the passed group name contains the current computer as a member. Returns True or False
Function IsMember(groupName)
If IsEmpty(groupList) then
Set groupList = CreateObject("Scripting.Dictionary")
groupList.CompareMode = TextCompare
ADSPath = "cmcinet.org" & "/" & UserName
Set userPath = GetObject("WinNT://" & ADSPath & ",user")
For Each listGroup in userPath.Groups
groupList.Add listGroup.Name, "-"
Next
End if
IsMember = CBool(groupList.Exists(groupName))
End Function
 
My guess is that the mapped drives were originally created using the /persistent:yes switch. Clear mapped drives using the code from mat305:

Code:
set objNetwork = CreateObject("WScript.Network")
set colDrives = objNetwork.EnumNetworkDrives

for i = 0 to colDrives.Count-1 Step 2
    objNetwork.RemoveNetworkDrive colDrives.Item(i)
next

-Geates
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top