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
Ingroup.exe /u /g [/r] [/s] [/h]
(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.
(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.
(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.
(Optional) (only functional with /s switch) Specifies that the scripts should run in hidden mode.
(Optional) Only valid with ‘/s’ switch. Path to scripts’ directory. If omitted, the NETLOGON share will be used.
Brings up the help screen
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.
ingroup /s /h /p ''fileserver'public'scripts
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.
Ingroup /r /g domain admins
This sample would return an errorlevel of 1 if the user is a member of the domain admins group.
Ingroup /r /s /h /g sales /p ''filesrver'public'scripts
This sample would execute ”filesrver’public’scripts’sales.bat if the current user is a member of the sales group (direct member or indirect).
Ingroup /r /s /h /g sales /u mydomain.com'user1
This sample would execute ”<Logonserver>’netlogon’sales.bat if mydomain.com’user1 is a member of the sales group (direct member or indirect).
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.
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.
More in Administrative Tools and Scripts
Delivering High Availability in the Hybrid Cloud
Mar 13, 2019 | Michael Otey
Introduction to the IT Roadmap Planning Tool for Microsoft 365
Feb 16, 2018 | Juan Carlos-Gonzalez Martin
Sponsored: Conquering Remote Desktop Challenges
Dec 21, 2017 | Michael Otey
Avoiding Accidental Changes with PowerShell's WhatIf and Confirm Parameters
Jun 12, 2017 | Missy Januszko
Migrate Content from Docs.com to OneDrive for Business
Jun 12, 2017 | Jussi Roine
Improving The User Provisioning Process
Nov 18, 2015 | Petri IT Knowledgebase
Most popular on petri