Bonjour à tous
Un petit exemple ci-dessous:
Set net = WScript.CreateObject("WScript.Network")
Set fso = WScript.CreateObject("Scripting.FileSystemObject")
Set args = WScript.Arguments
If args.Count = 0 Then
computer = net.ComputerName
Else
computer = args(0)
End If
Set GDict = WScript.CreateObject("Scripting.Dictionary")
Set UDict = WScript.CreateObject("Scripting.Dictionary")
Set GUset = GetObject("winmgmts:{impersonationLevel=impersonate}!//" & Computer).InstancesOf _
("Win32_GroupUser")
For Each GU in GUset
Set Group = GetObject("winmgmts:" & GU.GroupComponent)
set User = GetObject("winmgmts:" & GU.PartComponent)
GName = Group.Name
Uname = User.Name
If GDict.Exists(GName) Then
OldList = GDict.Item(GName)
GDict.Item(GName) = OldList& "," & UName
Else
GDict.Add GName, UName
End If
If UDict.Exists(UName) Then
OldList = UDict.Item(UName)
UDict.Item(UName)=OldList& "," & GName
Else
UDict.Add UName, GName
End If
Next
Dim GTabG,GtabU, UTabU, UTabG
GTabG = GDict.Keys
GtabU = GDict.Items
UTabU = UDict.Keys
UTabG = UDict.Items
jean-marc