Re: Trying to compare usernmae to a group membership
- From: "Richard Mueller [MVP]" <rlmueller-nospam@xxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 5 Sep 2007 19:26:02 -0500
Bill Tkach wrote:
I have a batch file script, that needs to see if a person belongs to a
certain group. So I'm trying to compare the %USERNAME% (logged on user) to
the members of the group, to see if I can get either a "doesn't match" or a
"does match".
Here's my query
dsget group "CN=Dudes,OU=OurOU,OU=ABC
Network,DC=abcdef,DC=ca" -expand -members | dsget user -samid -c | find
"%USERNAME%"
So, if you pass it the %username%, and there's a match, it returns the
username.
So, this gives me a name, but I can't match it the %USERNAME%... I can
only get it to return the value. I can't get past this step.
Is there another way to compare this, or, am I almost there?
--
Bill Tkach
MSP, CCNA, A+
visual{period}eyes{at}telus{period}net
It seems to work. If a name is echoed, the current user is a member. If
nothing is echoed, the current user is not a member of the group. What do
you want to accomplish?
--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--
.
- Follow-Ups:
- Re: Trying to compare usernmae to a group membership
- From: Kshaeta
- Re: Trying to compare usernmae to a group membership
- References:
- Trying to compare usernmae to a group membership
- From: Kshaeta
- Trying to compare usernmae to a group membership
- Prev by Date: Trying to compare usernmae to a group membership
- Next by Date: Re: add local printer
- Previous by thread: Trying to compare usernmae to a group membership
- Next by thread: Re: Trying to compare usernmae to a group membership
- Index(es):
Relevant Pages
|