IfMember command for computers?

I am trying to find out if there is a command that will check what group a computer is assigned. Like the IfMember command only for the computer name and not the user.

I am using Windows 2000 server with XP and 2000 clients.

Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

oBdAConnect With a Mentor Commented:
This should work; you need to specify a list of groups to check, and the according labels to jump to. The script uses the "net group SomeGroup /domain" command to list the group members and checks if the computer name is listed.

@echo off
:: *** List of groups to check the membership.
:: *** The names of these groups have to be defined as labels as well!
:: *** (see below)
set PrinterGroups=P1Group P2Group

:: ...
:: *** Other logon stuff
:: ...

for %%a in (%PrinterGroups%) do (
  net group %%a /domain | find /i "%ComputerName%$"
  if not errorlevel 1 call :%%a

:: ...
:: *** Other logon stuff
:: ...

goto leave
:: *** Subroutines for printer mapping.
:: *** ALL group names defined in the "PrinterGroups" variable
:: *** must be specified as labels here!

:: *** Printer mapping for P1Group
con2prt.exe \\PrintServer\P1
goto :eof

:: *** Printer mapping for P2Group
con2prt.exe \\PrintServer\P1
goto :eof

Ifmember in what language? Be more specific, please.
KTosserAuthor Commented:
IfMember is an executable command you download from Microsoft as part of the W2K resource kit.
It checks to see what group a user is a member of in Active Directory.  You can then use it to create login scripts that will check a users group membership then execute the script accordingly.  However I need something that will check a workstations membership instead of the users.

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

I allways used whoami.exe. I think the computer must be member of the same domain as the user logged on, otherwise the trusts cannot be established. Never heard of user beeing member of a domain and computer not, when talking about w2k and xp.

Tim HolmanCommented:
You mean whether or not a computer is logged onto a domain, and which domain ?
You could get this info from nbtstat -n ?
KTosserAuthor Commented:
No.... I only have one Domain in the network.

I am trying to Wright a login script that will check to see what group in Active Directory the computer (not user) is a member of.  Then install the correct printers based on what group they are in.  That way I can assign printers to computers and no matter who logs into that workstation they get the same printers installed.  I am trying to find out what command I can use in the script that will check the group membership in Active Directory of the computer.

5 computers:  C1, C2, C3, C4, and C5
2 Printers:  P1, and P2
I would have two workstation Groups: P1Group, and P2Group
If I wanted C1 and C4 to have P1 then I would put them in the P1Group and the login script would check that and install P1 because they are members of P1Group.

What command will check the workstation group a computer is a member of in Active Directory.  Even if it is an If/then statement... If P1Group then install P1, If P2Group installs P2.

Hope that makes more cense...

Thank you for helping.

All Courses

From novice to tech pro — start learning today.