Is there a way of performing operations depending on a users group membership?

John Savill

May 31, 1999

1 Min Read
ITPro Today logo in a gray background | ITPro Today

A. On the resource kit for NT you'll find a program called IFMEMBER, this is what you'll have to base your login script upon. Important safety tip, IFMEMBER works by checking for membership in a group and returning an ERRORLEVEL hence you'll have a bunch of IF THENS..

Ifmember sets errorlevel to the number of groups in the list that the user is actually a member of, for example:

groupa

savillj

Y

Y

N

If you typed command

ifmember  group1 group2

an errorlevel of 2 would be returned.

ifmember groupa 
if %errorlevel%==1

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like