Solved

IfMember command for computers?

Posted on 2004-09-23
8
1,041 Views
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.

Thanks,
0
Comment
Question by:KTosser
[X]
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
8 Comments
 
LVL 18

Expert Comment

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

Author Comment

by:KTosser
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.


0
 
LVL 18

Expert Comment

by:crissand
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.

0
Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

 
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 ?
0
 

Author Comment

by:KTosser
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.

Example
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.

0
 
LVL 84

Accepted Solution

by:
oBdA earned 125 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
setlocal
:: *** 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!

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

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

:leave
0
 
LVL 23

Expert Comment

by:Tim Holman
ID: 12201400
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Are you one of those front-line IT Service Desk staff fielding calls, replying to emails, all-the-while working to resolve end-user technological nightmares? I am! That's why I have put together this brief overview of tools and techniques I use in o…
This article offers some helpful and general tips for safe browsing and online shopping. It offers simple and manageable procedures that help to ensure the safety of one's personal information and the security of any devices.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

734 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