List-
Note that this script removes an entire directory structure (specified in the RootFolder var) in "quite" mode. Make sure you know what you are doing before you just run it. Not that anyone would do that, right?

t

On Mar 13, 2006, at 7:01 AM, [EMAIL PROTECTED] wrote:

Hi,

I have finally wrote a small vbscript to do what I wanted to do :

' Description : This script creates files containing the list of the members of the groups on an NT domain, using the full name of the users.

Dim groupsToAnalyze(1000,2)
Dim oFS
Dim strFile
Dim i
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8

'       Column 1 : Name of the group
'       Column 2 : Name of the folder that corresponds to that group
'       Column 3 : Owner of the folder

groupsToAnalyze(0,0) = "Group1"
groupsToAnalyze(0,1) = "Folder1"
groupsToAnalyze(0,2) = "Owner1"

'       Delete all files in the output folder...
RootFolder = "T:\groups\!Sécurité répertoires"
Set oShell = CreateObject("WScript.Shell")
oShell.Run "%comspec% /c cd /d """ & RootFolder & """ && rd . /s / q", 0, True

' Create output files (file names in the output will be "Owner - FolderName")
For Each group In groupsToAnalyze
        if isEmpty(group) Then Exit For
        Set oGroup = GetObject("WinNT://DOMAINNAME/" & group & ",group")
        For Each oUser In oGroup.Members
                Set oFS=CreateObject("Scripting.FileSystemObject")
Set strFile = oFS.OpenTextFile(RootFolder & "\" & groupsToAnalyze (i,2) & " - " & groupsToAnalyze(i,1) & ".txt", ForAppending, True)
                strFile.WriteLine(oUser.FullName)
                strFile.Close
        Next
        i = i + 1
Next

Thanks to everyone that helped me,

Benoît Fortin

---------------------------------------------------------------------- ----- ---------------------------------------------------------------------- -----





---------------------------------------------------------------------------
---------------------------------------------------------------------------

Reply via email to