InGroup

Posted on January 8, 2009 by Daniel Petri in Administrative Tools and Scripts with 0 Comments

Description

This utility enables an administrator to run batch files based on the user’s group membership without scripting complex batch files.

Requirements: This tool requires Windows NT4 (with Active Directory Client), Windows 2000, Windows XP or Windows Server 2003.

Note: Active Directory Client can be downloaded from HERE

Read more about the Active Directory Client in the Active Directory Client (dsclient) for Win98/NT page.

Note: If used with /r switch, MDAC must be installed. You can download MDAC from HERE

Download

Download ingroup.zip (18kb)

You need to extract the tool/script found in the downloaded file by using WinZip or similar.

Syntax

/u <domain.com’username>

(Optional) specifies the user to query. If omitted, the local user will be used.

/g <group name>

(Optional) specifies a specific group to search for.

/r

(Optional) specifies whether to perform a recursive search or flat search. If not specified, only the group which the user is a direct member of will be returned.

/s

(Optional) If used with /g switch, ”<domain name>’netlogon'<group name>.bat will be executed if the user is a member of the specified group.

If used without /g switch, ”<domain name>’netlogon'<group name>.bat will be executed for each group the user resides in.

/h

(Optional) (only functional with /s switch) Specifies that the scripts should run in hidden mode.

/p <path>

(Optional) Only valid with ‘/s’ switch. Path to scripts’ directory. If omitted, the NETLOGON share will be used.

/?

Brings up the help screen

Notes:

The command returns an errorlevel of 1 if the user is a member of the specified group (when using /g switch)

When /r switch is not specified, domain local groups will not be processed. In order to process domain local groups as well, you must specify the /r switch (make sure the client computers has MDAC installed.

MDAC can be easily deployed by download the installation file to a common network location and running it with the /q switch through a startup script  using group policy.

For example:

This sample would query the domain for the logged on user’s list of groups (Direct groups only). For each group returned, Ingroup will execute ”fileserver’public’scripts'<groupname>.bat in hidden mode.

This sample would return an errorlevel of 1 if the user is a member of the domain admins group.

This sample would execute ”filesrver’public’scripts’sales.bat if the current user is a member of the sales group (direct member or indirect).

This sample would execute ”<Logonserver>’netlogon’sales.bat if mydomain.com’user1 is a member of the sales group (direct member or indirect).

Support

No support of any sort will be given for this script/tool or for any other script/tool found on the Petri.co.il website for that matter. If you need to contact us with any support issues, feedback or suggestions regarding the tool(s) and script(s) found on this page please write an e-mail to THIS address.

Disclaimer

The software available from GanoTools is FREEWARE. It is not in the Public Domain. Asaf Ganot retains the copyright for this work. You can use it freely but do not claim it for your own or charge others money for it.

Use these tools at your own risk. They are provided for your own personal use and enjoyment and Asaf Ganot nor Daniel Petri nor Petri.co.il do not provide any warranty for them, nor they will be held responsible for any result allegedly caused by use or misuse of any of the tools found on this page.

Back to the Tools and Scripts page.

Sponsored