Bonjour,

Dans le script qui suit, j'ecris les infos des membres du groupe administrateurs local de chacun des ordinateurs qui se connectent au domaine.

Le probleme, c'est que 'objUser.Name' ne me revoie que User ou Group et ce que je voudrais quand il s'agit d'un User, c'est de savoir s'il est local ou du domaine.

Merci

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
Dim fso, flog
Dim WshShellObj,WshProcessEnv
Dim fileLogPath,ComputerName
Dim objGroup,strComputer,objUser,objADSysInfo
 
'récupère le nom de connexion réseau et le nom de l'ordinateur
Set WshShellObj = CreateObject("WScript.Shell")
Set WshProcessEnv  = WshShellObj.Environment("Process") 
ComputerName = WshProcessEnv ("COMPUTERNAME")
 
'Construit le nom du fichier log à partir de la variable d'environnement
' %COMPUTERNAME%.CSV
fileLogPath = LOGSHARE & ComputerName & ".csv"
 
 
 
 
'Création du fichier log
Set fso = CreateObject("Scripting.FileSystemObject")
Call OpenFile(fileLogPath,flog,ForWriting)
 
'Ecriture du fichier log
strComputer = "."
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrateurs,group")
'récupere l'OU
Set objADSysInfo = CreateObject("ADSystemInfo" )  
 
    For Each objUser in objGroup.Members
        flog.Writeline Date & ";" & ComputerName & ";" & objUser.Name & ";" & objUser.Class & ";" & objADSysInfo.SiteName
 
    Next
 
 
'-------------------------------------------------------------------------
' Open file (r/w) and return associated handle
'-------------------------------------------------------------------------   
Function OpenFile(byval vFileName,ByRef vHandle,byval vMode)
Set vHandle = fso.OpenTextFile(vFileName, vMode, True)
If err.number<> 0 Then
	wscript.echo "Error while opening "+vFileName+ " --- error n°"+CStr(Err.Number) + "[" + Err.Description+"]"
	Wscript.quit (Err.Number)
End If
End Function