[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1082
  • Last Modified:

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.

Thanks,
0
KTosser
Asked:
KTosser
  • 2
  • 2
  • 2
  • +1
1 Solution
 
crissandCommented:
Ifmember in what language? Be more specific, please.
0
 
KTosserAuthor Commented:
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
 
crissandCommented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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

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
 
oBdACommented:
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

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

  • 2
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now