Voila je sais que c'est un sujet qui revient souvent et que plusieurs solution sont données mais j'explique quand même mon problème:
J'effectue un script wsh qui permet de mapper des lecteurs réseaux à des users en fonction de leur groupe d'appartenance.
En algo sa donne :
POUR chaque utilisateur du domaine alors
IF user est membre du group direction alors
IF user est membre du groupe Compta alors
IF user est membre du groupe General alors
ENDIF
FINPOUR
Et j'ai du mal pour ma boucle pour et les déclarations :s
pour le moment j'ai un script de ce style la :
Merci de votre aide !Code:
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 Dim wshNetwork Set WshNetwork = WScript.CreateObject("WScript.Network") CONST DIRECTION_GROUP = "cn=Direction" CONST COMPTA_GROUP = "cn=Compta" CONST GENERAL_GROUP = "cn=Direction" Set ADSysInfo = CreateObject("ADSystemInfo") Set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName) strGroups = LCase(Join(CurrentUser.MemberOf)) FOR EACH strUserName IN strUserDomain On Error resume Next 'Suppression des anciens lecteurs réseaux Set WshNetwork = WScript.CreateObject("WScript.Network")WshNetwork.RemoveNetworkDrive "T:" Set WshNetwork = WScript.CreateObject("WScript.Network")WshNetwork.RemoveNetworkDrive "N:" Set WshNetwork = WScript.CreateObject("WScript.Network")WshNetwork.RemoveNetworkDrive "U:" Set WshNetwork = WScript.CreateObject("WScript.Network")WshNetwork.RemoveNetworkDrive "P:" 'L'objet WshNetwork est obtenu en créant une instance de l'objet COM identifié par le progID «WScript.WshNetwork« : Set NetworkDisk = WScript.CreateObject("WScript.Network" ) If InStr (strGroups, DIRECTION_GROUP) Then WshNetwork.MapNetworkDrive "T:", "\\SRV-PERSo\Commun" WshNetwork.MapNetworkDrive "N:", "\\SRV-PERSO\Compta" WshNetwork.MapNetworkDrive "U:", "\\SRV-PERSO\Direction" WshNetwork.MapNetworkDrive "P:", "\\SRV-PERSO\USERS$\%Username%" ELSEIF InStr (strGroups, COMPTA_GROUP) Then WshNetwork.MapNetworkDrive "T:", "\\SRV-PERSo\Commun" WshNetwork.MapNetworkDrive "N:", "\\SRV-PERSO\Compta" WshNetwork.MapNetworkDrive "P:", "\\SRV-PERSO\USERS$\%Username%" ELSEIF InStr (strGroups, GENERAL_GROUP) Then WshNetwork.MapNetworkDrive "T:", "\\SRV-PERSo\Commun" WshNetwork.MapNetworkDrive "P:", "\\SRV-PERSO\USERS$\%Username%" END IF