Re: EnumLocalGroup.vbs - only want logon account name and description fields
- From: "Richard Mueller [MVP]" <rlmueller-nospam@xxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 19 Jan 2008 13:03:33 -0600
Mack wrote:
There is a vbs script created by Richard Mueller that enumerates
members of local groups. The report it generats contains alot of
information that I don't need. My knowledge of vbs is almost nill.
What would I have to change in the vbs script to have it only write
out the logon account name and the description field? These are the
only 2 fields of information I need. Also, is there any way to format
it so the logon on name starts in a specific column and the
description field starts in a specific column?
http://www.rlmueller.net/Programs/EnumLocalGroup.txt
Any insight would be greatly appreciated.
This is fairly easy to do. The script has two identical lines that output to
the console, one if the member is a member of a local group and another if
the member is a member of a nested domain group. Replace the two instances
of this line:
Wscript.Echo objMember.AdsPath
with the following:
Wscript.Echo strComputer & "," & objMember.Name & "," &
objMember.description
This works because the variable strComputer is a global variable (defined in
the main program) and so available in both subroutines. In both subroutines
we use the WinNT provider, so the .Name and .Description attributes give us
what you want. This gives the output in a comma delimited form that can be
read into a spread***. The program should be run at a command prompt using
the cscript host. The output can be redirected to a text file. For example
(assuming you are in the folder where the *.vbs file is saved):
cscript //nologo EnumLocalGroup.vbs > members.csv
If you want to delimit by tabs instead of commas, this can also be done. The
statement would be:
Wscript.Echo strComputer & vbTab & objMember.Name & vbTab &
objMember.description
--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--
.
- Follow-Ups:
- References:
- Prev by Date: Re: Need a script to check the status of AD user
- Next by Date: Re: Need a script to check the status of AD user
- Previous by thread: Re: EnumLocalGroup.vbs - only want logon account name and description fields
- Next by thread: Re: EnumLocalGroup.vbs - only want logon account name and description fields
- Index(es):