Skip navigation

JSI Tip 0100 - Alter a login script based on group membership.

If you are not ready to implement a login script processor like Kix95 (from the resource kit), you can use a simple exe in your current script. ifmember (also from the resource kit) allows you to test for membership in one or more groups. Here is an example:

\\SERVER\NETLOGON\ifmember "Accountants" "Accounts Payable"
REM 0=none, 1=one of the groups, 2 =two of the listed groups
if ERRORLEVEL 1 goto apac%errorlevel%
:sales
\\SERVER\NETLOGON\ifmember "Sales"
If NOT ERRORLEVEL 1 goto common
net use s: \\ServerName\Sales$ /persistent:no
goto common
:apac1
REM Either a member of Accountants or Accounts Payable
\\SERVER\NETLOGON\ifmember "Accountants"
if ERRORLEVEL 1 goto acct
net use x: \\ServerName\ap$ /persistent:no
goto sales
:acct
net use y: \\ServerName\acct$ /persistent:no
goto sales
:apac2
REM Membership in both Accountants and A/P
net use x: \\ServerName\ap$ /persistent:no
net use z: \\ServerName\accctap$ /persistent:no
goto acct
:common
net use h: /home
exit



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish