Bonjour,

J'ai fait 2 scripts ci-dessous, le premier pour rechercher tous les dossiers et sous-dossiers dans mon lecteur r: appelés "prive" et le deuxieme pour rechercher les groupes de sécurité(commencant par FR_DEPT ou LTGFR) sur un dossier.
Mon problème est que je voudrais concatener les 2 scripts pour qu'à chaque fois qu'il trouve un dossier nommé "prive", il cherche s'il y a des groupes de sécurité qui y sont affecté....
Pourriez-vous m'aider ?
Merci bcp,

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
'------------------------------------- 1er script
 
Option Explicit
 
Dim path_start
Dim subfolder
Dim Myfso, result
Set Myfso = CreateObject("Scripting.FileSystemObject")
 
path_start = "R:"
subfolder = "prive"
 
result = Find(path_start, subfolder)
 
 
 
Function Find (strPath, strFileName)
	Dim MyDir, MyFile, MySubDir
	Dim strResult
 
	If strFileName = Empty Then Exit Function
	strFileName = Ucase(strFileName)
 
	Set MyDir = Myfso.GetFolder(strPath)
 
	For Each MyFile In MyDir.subFolders
		If Ucase(MyFile.Name) = strFileName Then strResult = strResult & strPath & "\" & MyFile.Name & vbCrLf
	Next
 
	For Each MySubDir In MyDir.SubFolders
		strResult = strResult & Find(strPath & "\" & MySubDir.Name, strFileName)
	Next
 
	Find = strResult
 
End Function
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
'---------------------------------- 2eme script
strFolderName = "Le dossier prive de mon 1er script"
Const INPUT1_FILE_NAME = "c:\test1.txt"
 
Const FOR_READING = 1, FOR_WRITING = 2, FOR_APPEND = 8
 
 
Const OVER_WRITE_EXISTING = True
Set WshShell = WScript.CreateObject("WScript.Shell")
   Dim fso, f
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.OpenTextFile(INPUT1_FILE_NAME, FOR_APPEND,true)
 
Set objWMIService = GetObject("winmgmts:")
Set objFolderSecuritySettings = _
objWMIService.Get("Win32_LogicalFileSecuritySetting='" & strFolderName & "'")
intRetVal = objFolderSecuritySettings.GetSecurityDescriptor(objSD)
 
intControlFlags = objSD.ControlFlags
 
      arrACEs = objSD.DACL
 
      For Each objACE in arrACEs
 
		if Left(objACE.Trustee.Name,7) = "FR_DEPT" then 
		f.write(strFolderName & "           ")
		f.write(objACE.Trustee.Domain & "\" & objACE.Trustee.Name  + VbCrLf)
 
		WScript.Echo strFolderName
		WScript.Echo objACE.Trustee.Domain & "\" & objACE.Trustee.Name
 
		 else 
			if Left(objACE.Trustee.Name,5) = "LTGFR" then
			f.write(strFolderName & "             ")
			f.write(objACE.Trustee.Domain & "\" & objACE.Trustee.Name  + VbCrLf)
 
			WScript.Echo strFolderName
			WScript.Echo objACE.Trustee.Domain & "\" & objACE.Trustee.Name
			end if
 
		 end if
      next