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
|
ON ERROR RESUME NEXT
set WshShell = CreateObject("WScript.Shell")
Set WshNetwork = WScript.CreateObject("WScript.Network")
if WshShell.ExpandEnvironmentStrings("%OS%") <> "Windows_NT" then
WshShell.Run "COMMAND.EXE /C NET TIME \\BTW-USER1 /SET /Y >NUL:"
DomainName=WshShell.RegRead("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MSNP32\NetworkProvider\AuthenticatingAgent")
Set UserObj = GetObject("WinNT://" & DomainName & "/" & WshNetwork.username)
WshNetwork.MapNetworkDrive "U:",UserObj.HomeDirectory
' msgbox (UserObj.homeDrive)
msgbox (UserObj.HomeDirectory)
else
DomainName=WshShell.ExpandEnvironmentStrings("%USERDOMAIN%")
Set UserObj = GetObject("WinNT://" & DomainName & "/" & WshNetwork.username)
end if
Dim UserGroups
Dim GroupObj
Dim strNomServeur as string 'nom du serveur de fichier
Dim tabGroupeUser(intMAXTAB) 'tableau des groupes
Dim index=0 'index d'accès aux valeurs du tableau
Dim intMAXTAB as integer 'nombre de groupes max qui sera utilisée dans le tableau pour mapper les lecteurs.
'Initialisation des variables utilisées.
UserGroups=""
strNomServeur="xxxx"
intMAXTAB = 10
'Création d'un tableau contenant la liste des groupes dont l'utilisateur est MEMBRE
'tableau de 10 valeurs max.
For index=0 to (intMAXTAB-1)
'For Each GroupObj In UserObj.Groups
tabGroupeUser(index)=GroupObj.Name
Next
For index=0 to (intMAXTAB-1)
Select case InGroup(tabGroupeUser(index))
case "dl_PoleG06":
if TesterLecteur("S:")
WshNetwork.MapNetworkDrive "S:","\\"&strNomServeur&"\G06"
CreerRaccourciReseau "Fichiers service G06","S","Fichiers service G06"
end If
case "dl_PoleG07":
WshNetwork.MapNetworkDrive "S:","\\"&strNomServeur&"\G07"
CreerRaccourciReseau "Fichiers service G07","S","Fichiers service G07"
case "dl_PoleG08":
WshNetwork.MapNetworkDrive "S:","\\"&strNomServeur&"\G08"
CreerRaccourciReseau "Fichiers service G08","S","Fichiers service G08"
case "dl_PoleI03":
WshNetwork.MapNetworkDrive "S:","\\"&strNomServeur&"\I03"
CreerRaccourciReseau "Fichiers service I03","S","Fichiers service I03"
case "dl_PoleIntersectoriel":
WshNetwork.MapNetworkDrive "S:","\\"&strNomServeur&"\G06"
CreerRaccourciReseau "Fichiers service G06","S","Fichiers service G06"
case else wscript.echo "coucou"
Next |
Partager