Citation :
Dim objRootLDAP, objGroup, objUser, objOU, objmemberOf Dim strOU, strUser, strDNSDomain, strLDAP, List, objADSysInfo,arr,intlength,intNamelength,strGroupName
' Commands to bind to AD Set objRootLDAP = GetObject("LDAP://RootDSE" ) Set objNetwork = CreateObject("Wscript.Network" )
'trouver le DN de l'utilisateur Set objADSysInfo = CreateObject("ADSystemInfo" ) strUser = objADSysInfo.UserName Set objUser = GetObject("LDAP://" & strUser)
' Extract a list of Groups from memberOf objmemberOf = objUser.GetEx("memberOf" ) For Each objGroup in objmemberOf
List = List & objGroup & vbCr arr=Split(List,"," ) intlength=Len(arr(0)) intNamelength=intlength - 3 Next strGroupName= Right(arr(0), intNameLength)
'Connecter un lecteur en fonction du groupe Select Case strGroupName Case "Etudiant" objNetwork.MapNetworkDrive "X:", "\\Serveur\Partage"
Case "Personnel"
objNetwork.MapNetworkDrive "X:", "\\Serveur\Partage"
End Select WScript.Quit
|