Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Script adding text to end of line of output from AD Query

Status
Not open for further replies.

itsmythg

Technical User
Apr 4, 2001
34
0
0
US
The script below queries Active directory looking for a specific security group it works great, but what i want is for it to write the name of the group to the end of every line it creates.
[red]EXAMPLE
Hoffa, Jim xxxxxxx myadgroup1[/red] the myadgroup1 i want to add to every line of this group query.

set fso = createobject("scripting.filesystemobject")
set fh = fso.createtextfile("ADGROUP.txt")

set groupObj = getobject("LDAP://cn=ADGROUPNAME,ou=securityteam,ou=securitygroups,ou=process,dc=lcc,dc=usairways,dc=com")

count = 0
for each member in groupObj.members
WScript.echo Member.displayname & " ; " & Member.lcchirschbadgenum '
fh.writeline member.displayname & " ; " & Member.lcchirschbadgenum '
count = count + 1
NEXT
fh.close
wscript.echo "Total members: " & count


Thanks in advance for your help.
 
ok i posted too fast i figured it out. thanks anyway.
 
add groupObj.Name to the end of output.

Code:
 fh.writeline member.displayname & " ; " [red]& groupObj.Name [/red]

-Geates

"I hope I can feel and see the change - stop the bleed inside a feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top