Go Back   TechArena Community > Technical Support > Computer Help > Windows Server > Windows Server Help
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



List of all parameters for objuser

Windows Server Help


Reply
 
Thread Tools Search this Thread
  #1  
Old 13-03-2007
Mike Matheny
 
Posts: n/a
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





Reply With Quote
  #2  
Old 13-03-2007
Richard Mueller [MVP]
 
Posts: n/a
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
--


Reply With Quote
Reply

  TechArena Community > Technical Support > Computer Help > Windows Server > Windows Server Help
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "List of all parameters for objuser"
Thread Thread Starter Forum Replies Last Post
How to fix ?Failed to set write parameters. Reason Invalid field in parameter list? error message on ImgBurn? Manthan G Windows Software 3 25-03-2012 10:16 AM
URL dynamic parameters Bricklayer Software Development 6 02-08-2010 10:30 AM
VBA Recordset / Parameters Gunner 1 Software Development 5 17-02-2010 12:38 AM
BIOS parameters bayz Overclocking & Computer Modification 4 01-01-2009 10:48 PM
Displays a list of your page parameters in ASP.Net kex Software Development 0 14-11-2008 01:26 PM


All times are GMT +5.5. The time now is 02:19 PM.