Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

If member of "group"in Microsoft Logon Script

Posted on 2007-11-28
4
Medium Priority
?
6,927 Views
Last Modified: 2009-08-14
I came from a Novell environment using NDS and now have a need to check if a user is a member of a group in the logon script:

Set.......what ever
next statement....whatever
IF MEMBER OF "DIRECTORS: THEN
  RUN THIS
ENDIF

That's all I wan to do, but can't find out how to do an if statement in the logon script
0
Comment
Question by:hospicecc
[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
  • 3
4 Comments
 
LVL 38

Expert Comment

by:Hypercat (Deb)
ID: 20368531
First, you need to download the Windows Resource Kit tools.  There is a specific tool in there named "ifmember.exe."  You need to put this executable in your NETLOGON share, and then used the statement in the login script as described:

ifmember [/v|/verbose [/l|/list]|[GroupName1 [GroupName2] ...]

/v|/verbose GroupName1 [GroupName2] ...]
Prints all group matches.

Note
If you are using IfMember interactively, you must use the /v parameter to determine whether or not the current user is a member of the specified group.

/l|/list
Lists all groups of which the user is a member.

GroupName
Specifies one or more group names (separated by a spaces).

The above help information and additional more detailed information on the tool is in the help file that comes along with the resource kit.
0
 
LVL 38

Accepted Solution

by:
Hypercat (Deb) earned 2000 total points
ID: 20368587
PS Here's a more specific sample:

set GROUP1=YourGroup
<<Insert additional "set" commands for additonal groups>>

if "%GROUP1%"=="" goto NOGROUP1
      ifmember %GROUP1%
      if not errorlevel 1 goto NOGROUP1
                    <<Insert here the drives you want to map or other commands to run for group members>>
NOGROUP1
<<Insert here other commands not dependent on group membership.>>

You repeat the if statement section as often as necessary to cover all groups defined in the set commands.

0
 

Author Comment

by:hospicecc
ID: 20368662
This is really great information and I'll get ifmember in just a minute..Thanks.

The group I'm trying to query is a group(s) already defined in AD however not established  through a set command.  

I won't have the opportunity to execute a specific set command to set up a variable, so I'll have to go against group membership already established in AD.
0
 
LVL 38

Expert Comment

by:Hypercat (Deb)
ID: 20368748
The "set" command is part of the script - shown at the top of my example - that is referring to the groups defined in Active Directory.  It just declares the value for the variable named "GROUP1" in the script. For example, if your AD group is called, as in my sample, "YourGroup," then in your login script, your "set" command to define the variable "GROUP1" is:

set GROUP1 = YourGroup

Then, in the if statement referring to %GROUP1%, the script will substitute the value "YourGroup" when it runs.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

by Nathan Brom/Bromy2004 Introduction There are numerous websites out there for any different type of program you can imagine.  Of those, you'll need to decide which ones are legitimate and aren't trying to steal your money or infect your comput…
Log files are useful in diagnosing and repairing problems.  This is a list of common log files and their standard locations that I've compiled.   While this is not exhaustive, it is a pretty good list that I've found to be useful.  I may update it f…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

636 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