Solved

IfMember command for computers?

Posted on 2004-09-23
8
1,011 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
  • 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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
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 83

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Enterprise networks where VoIP phones have been deployed frequently use port configurations that allow both a computer and an IP phone to be plugged into the same switch port but use different VLANs. On Cisco equipment I'm referring to the "native V…
The Need In an Active Directory enviroment, the PDC emulator provide time synchronization for the domain. This is important since Active Directory uses Kerberos for authentication.  By default, if the time difference between systems is off by more …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now