J'ai mon script qui fonctionne bien mais j'arrive pas a voir ou l'erreur se situe...Tout est bien écrit le "For each" se fait mais lorsque ça écrit dans le xls je ne vois que le dernier nom...je vois par contre tout les autres noms défiler et ce sur colone A rangé 2
Une erreur simple je suis sur...
merci de l'aide
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3Nom HomeDir Script Mail Padawan Éclaireur u:\\domain\usager\ens\0003452 ENS.BAT Padawaneclaireur@domain.com
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62 Dim objXL Set objDictionary = CreateObject("Scripting.Dictionary") Set objOU = GetObject("LDAP://blabla") objOU.Filter = Array("User") Const ForAppending = 2 Set objFSO = CreateObject("Scripting.FileSystemObject") Set objXL = WScript.CreateObject("Excel.Application") strfilepath = "C:\Users\padawan\Desktop\status" Set objTextFile = objFSO.CreateTextFile(strfilepath & ".xls",ForAppending, True) objXL.Workbooks.Add objXL.Cells(1, 1).Value = "Nom" objXL.Cells(1, 2).Value = "HomeDir" objXL.Cells(1, 3).Value = "Script" objXL.Cells(1, 4).Value = "Mail" objXL.Columns(1).ColumnWidth = 28 objXL.Columns(2).ColumnWidth = 65 objXL.Columns(3).ColumnWidth = 15 objXL.Columns(4).ColumnWidth = 70 'set column headings to Blue objXL.Range("A1:E1").Select objXL.Selection.Font.ColorIndex =5 iRow=2 iColumn=1 For Each objUser in objOU strUser = objUser.distinguishedName If Not objDictionary.Exists(strUser) Then If isnull(objUser.homeDrive) or len(trim(objUser.homeDrive)) = 0 Then strText1 = "No" objUser.homeDrive = strText1 If isnull(objUser.homeDirectory) or len(trim(objUser.homeDirectory)) = 0 Then strText2 = " Pas de map" objUser.homeDirectory = strText2 If isnull(objUser.scriptPath) or len(trim(objUser.scriptPath)) = 0 Then strText3 = "Pas de script" objUser.scriptPath = strText3 If isnull(objUser.mail) or len(trim(objUser.mail)) = 0 Then strText4 = "Pas d'Email" objUser.mail = strText4 End If End If End If End If objXL.Cells(iRow,iColumn).Value=UCase(objUser.displayName) objXL.Cells(iRow,iColumn+1).value=objUser.homeDrive & objUser.homeDirectory objXL.Cells(iRow,iColumn+2).value=objUser.scriptPath objXL.Cells(iRow,iColumn+3).value=objUser.mail 'show the spreadsheet objXL.Visible = True End If Next
Partager