|
Hello all,
I made 2 scripts under, the first for search all folders and subfolders (named "prive") in my R: Drive and the second for search security groups(begin by FR_DEPT ou LTGFR) on a folder.
I want to concatenate scripts for each "prive" folder, it could search if groups are affected.
Can you help me please?
Thanks in advance
'------------------------------------- 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
'---------------------------------- 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
|
|
|
|
|
"Concatenating" won't do much good, you'll need to merge them and call one function from the other. Shouldn't be too hard if you wrote it.
|
|
|
|