I am trying to write a script that will enumerate all users in a group, and
I need to get the domain they belong to also. I cannot find how to get the
domain with objuser.
============
'on error resume next
'Script begins here
Dim objGroup, objUser, objFSO, objFile, strDomain, strGroup, Domain, Group,
strFilename
'Change DomainName to the name of the domain the group is in
strDomain = "jsc-iss"
'strDomain = Inputbox ("Enter the Domain name", "Data needed", "Default
domain name")
'Change GroupName to the name of the group whose members you want to export
'strGroup = "Group"
strGroup = InputBox ("Enter the Group name", "Data needed", "Default group
name")
Set objFSO = CreateObject("Scripting.FileSystemObject")
'On the next line change the name and path of the file that export data will
be written to.
'Set objFile = objFSO.CreateTextFile("C:\final" & strGroup & " -
Members.txt")
Set objFile = objFSO.CreateTextFile(strGroup & "-Members.txt")
strFilename = strGroup & "-Members.txt"
Set objGroup = GetObject("WinNT://" & strDomain & "/" & strGroup & ",group")
'Set objGroup = GetObject("WinNT://" & strGroup & ",group")
For Each objUser In objGroup.Members
objFile.WriteLine objUser.Name
Next
objFile.Close
Set objFile = Nothing
Set objFSO = Nothing
Set objUser = Nothing
Set objGroup = Nothing
Wscript.Echo "Done"
Wscript.Echo "Please check " & strFilename & " for the output"
--
Mike Matheny
Bookmarks