Command Prompt:
gpresult /V
Search This Blog
Showing posts with label groups. Show all posts
Showing posts with label groups. Show all posts
Monday, August 15, 2016
Thursday, January 12, 2012
List Users in a Group Active Directory
Dim arrNames()
intSize = 0
Set objGroup = GetObject("LDAP://CN=Accountants,OU=Finance,DC=fabrikam,DC=com")
For Each strUser in objGroup.Member
Set objUser = GetObject("LDAP://" & strUser)
ReDim Preserve arrNames(intSize)
arrNames(intSize) = objUser.CN
intSize = intSize + 1
Next
For i = (UBound(arrNames) - 1) to 0 Step -1
For j= 0 to i
If UCase(arrNames(j)) > UCase(arrNames(j+1)) Then
strHolder = arrNames(j+1)
arrNames(j+1) = arrNames(j)
arrNames(j) = strHolder
End If
Next
Next
For Each strName in arrNames
Wscript.Echo strName
Next
intSize = 0
Set objGroup = GetObject("LDAP://CN=Accountants,OU=Finance,DC=fabrikam,DC=com")
For Each strUser in objGroup.Member
Set objUser = GetObject("LDAP://" & strUser)
ReDim Preserve arrNames(intSize)
arrNames(intSize) = objUser.CN
intSize = intSize + 1
Next
For i = (UBound(arrNames) - 1) to 0 Step -1
For j= 0 to i
If UCase(arrNames(j)) > UCase(arrNames(j+1)) Then
strHolder = arrNames(j+1)
arrNames(j+1) = arrNames(j)
arrNames(j) = strHolder
End If
Next
Next
For Each strName in arrNames
Wscript.Echo strName
Next
Tuesday, January 10, 2012
Print List of Groups in OU
Ref: http://blogs.technet.com/b/heyscriptingguy/archive/2005/09/21/how-can-i-list-all-the-groups-in-an-ou.aspx
Ref: http://www.devguru.com/technologies/vbscript/quickref/filesystemobject_createtextfile.html
Set objOU = GetObject("LDAP://OU=Users,OU=Groups,OU=City,OU=Work,OU=Dept,DC=xx,DC=yy,DC=zz")
objOU.Filter = Array("Group")
Set fso = CreateObject("Scripting.FileSystemObject")
Set fsoFile = fso.CreateTextFile("C:\Windows\Temp\listgroupsinou.txt")
For Each objGroup in objOU
fsoFile.WriteLine(objGroup.Name)
' Wscript.Echo objGroup.Name
Next
fsoFile.Close
Ref: http://www.devguru.com/technologies/vbscript/quickref/filesystemobject_createtextfile.html
Set objOU = GetObject("LDAP://OU=Users,OU=Groups,OU=City,OU=Work,OU=Dept,DC=xx,DC=yy,DC=zz")
objOU.Filter = Array("Group")
Set fso = CreateObject("Scripting.FileSystemObject")
Set fsoFile = fso.CreateTextFile("C:\Windows\Temp\listgroupsinou.txt")
For Each objGroup in objOU
fsoFile.WriteLine(objGroup.Name)
' Wscript.Echo objGroup.Name
Next
fsoFile.Close
Subscribe to:
Posts (Atom)