Results 1 to 2 of 2

Thread: List of all parameters for objuser

  1. #1
    Mike Matheny Guest

    List of all parameters for objuser

    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





  2. #2
    Richard Mueller [MVP] Guest

    Re: List of all parameters for objuser

    Mike Matheny wrote:

    >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"
    >


    If you are using the WinNT provider, the AdsPath property method of the user
    object includes the domain. You can parse the value for the NetBIOS name of
    the domain. If using the LDAP provider, the distinguishedName include the
    DNS name of the domain. Again you need to parse. LDAP also exposes AdsPath
    if you prefer.

    --
    Richard Mueller
    Microsoft MVP Scripting and ADSI
    Hilltop Lab - http://www.rlmueller.net
    --



Similar Threads

  1. Replies: 3
    Last Post: 25-03-2012, 10:16 AM
  2. URL dynamic parameters
    By Bricklayer in forum Software Development
    Replies: 6
    Last Post: 02-08-2010, 10:30 AM
  3. VBA Recordset / Parameters
    By Gunner 1 in forum Software Development
    Replies: 5
    Last Post: 17-02-2010, 12:38 AM
  4. BIOS parameters
    By bayz in forum Overclocking & Computer Modification
    Replies: 4
    Last Post: 01-01-2009, 10:48 PM
  5. Displays a list of your page parameters in ASP.Net
    By kex in forum Software Development
    Replies: 0
    Last Post: 14-11-2008, 01:26 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,751,669,457.44122 seconds with 16 queries