Batch files using IfMember

By Bryan Muehlberger, ITworld |  How-to

This week, I wanted to remind you of a useful batch file utility called
IfMember (ifmember.exe) which can be found in the Windows 2000 Resource
Kit or on Microsoft's website at:
http://www.microsoft.com/windows2000/techinfo/reskit/tools/new/ifmember-...

IfMember is a great utility for checking a user's membership while
processing a batch file. For example, let's assume that you have a
batch file in which you want to run one subset of commands if a user is
a member of a special migration group called MigrationUsers. If they are
not a member of the group, and you do not want to execute the migration
commands, you would rather exit the batch file. By using IfMember you
will be able to accomplish this using the following code snippet:

----- Begin Code Snippet ----

@echo off
:Begin
ifmember "MigrationUsers"
if not errorlevel 1 goto NoMigration

:Migrate
rem Put your code to do migration here

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Answers - Powered by ITworld

ITworld Answers helps you solve problems and share expertise. Ask a question or take a crack at answering the new questions below.

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Ask a Question