jazzyjeff Posted May 26, 2010 Share Posted May 26, 2010 Hi, I am using the following script to map network drives based on user group membership: expandcollapse popup#include<AD.au3> DriveMapDel ("H:") DriveMapDel ("I:") DriveMapDel ("J:") DriveMapDel ("K:") DriveMapDel ("L:") DriveMapDel ("M:") DriveMapDel ("N:") DriveMapDel ("O:") DriveMapDel ("P:") DriveMapDel ("Q:") DriveMapDel ("R:") DriveMapDel ("S:") DriveMapDel ("V:") DriveMapDel ("W:") DriveMapDel ("X:") DriveMapDel ("Y:") DriveMapDel ("Z:") Global $aUser, $sFQDN_Group, $sFQDN_User, $iResult ; Open Connection to the Active Directory _AD_Open() ; Get the Fully Qualified Domain Name (FQDN) for the current user $sFQDN_User = _AD_SamAccountNameToFQDN() ; Get an array of group names (FQDN) that the current user is immediately a member of $aUser = _AD_GetUserGroups(@UserName) $sFQDN_Group = $aUser[1] ; Check the group membership of the specified user for the specified group $iResult = _AD_IsMemberOf($sFQDN_Group, $sFQDN_User) Select Case $iResult = "Domain Admins" DriveMapAdd("M:","\\app2\K5-Staff") DriveSetLabel("M:\","M Drive - Apps") DriveMapAdd("N:","\\app2\K5-Common") DriveSetLabel("N:\","N Drive - Common Apps") DriveMapAdd("T:","\\staffshare1\departmentshares$\Technology") DriveSetLabel("T:\","T Drive - Technology") DriveMapAdd("X:","\\techstore1\toolbox$") DriveSetLabel("X:\","X Drive - Toolbox") DriveMapAdd("Y:","\\techstore1\toolbox$\Deployment Drive\Elementary") DriveSetLabel("Y:\","Y Drive - Deployment") DriveMapAdd("Z:","\\StaffStore2\Userdata$\" &@UserName) DriveSetLabel("Z:\","Z Drive - " & @UserName & " - Home Directory") EndSelect ; Close Connection to the Active Directory _AD_Close() The drive mapping part works fine, but the labels work for some of the drives and not others. Why is this? I am guessing my code is ok if it works for some of the drives, but maybe there is a problem with the "DriveSetLabel" function? I have attached an image to help understand what I mean. The drives should read: M Drive - Apps N Drive - Common Apps T Drive - Technology etc.. Thanks in advance for any help. Jeff Link to comment Share on other sites More sharing options...
wraithdu Posted May 26, 2010 Share Posted May 26, 2010 This is the example forum, not help. Link to comment Share on other sites More sharing options...
jazzyjeff Posted May 26, 2010 Author Share Posted May 26, 2010 I know. Sorry I forgot myself as I was typing this, and I have placed a topic for in the General Help forum. Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now