IfMember command for computers?

Posted on 2004-09-23
Medium Priority
Last Modified: 2008-04-29
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.

Question by:KTosser
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
LVL 18

Expert Comment

ID: 12143903
Ifmember in what language? Be more specific, please.

Author Comment

ID: 12146764
IfMember is an executable command you download from Microsoft as part of the W2K resource kit.  http://www.microsoft.com/windows2000/techinfo/reskit/tools/new/ifmember-o.asp
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.

LVL 18

Expert Comment

ID: 12159179
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.

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

LVL 23

Expert Comment

by:Tim Holman
ID: 12190221
You mean whether or not a computer is logged onto a domain, and which domain ?
You could get this info from nbtstat -n ?

Author Comment

ID: 12191962
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.

LVL 85

Accepted Solution

oBdA earned 500 total points
ID: 12198469
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


Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A brief overview to explain gateways, default gateways and static routes OR NO - you CANNOT have two default gateways on the same server, PC or other Windows-based network device. In simple terms a gateway is formed when a computer such as a serv…
Greetings, Experts! First let me state that this website is top notch. I thoroughly enjoy the community that is shared here; those seeking help and those willing to sacrifice their time to help. It is fantastic. I am writing this article at th…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question