Link to home
Start Free TrialLog in
Avatar of tobycruz
tobycruz

asked on

ifmember login script syntax

trying to create a login script using "ifmember" i want batch file to add a printer based on group membership, i also need to add shortcuts to the desktop and map some network drives below is what i have so far but it doenst seem to work

ifmember "PT Data Production"
rundll32 printui.dll,PrintUIEntry /in /u /z /n"\\blackberry2\BB2_BW_Prod_4300"
rundll32 printui.dll,PrintUIEntry /y /n"\\blackberry2\BB2_BW_Prod_4300"

copy /y "\\nycluster\share\Applications\Production Resources.lnk" "C:\documents and settings\%username%\desktop"
copy /y "\\nycluster\share\Applications\Launch DMS.url" "C:\documents and settings\%username%\desktop"
copy /y "\\nycluster\share\Applications\Launch Training DMS.url" "C:\documents and settings\%username%\desktop"


net use s: /delete
net use u: /delete
net use S: \\nyprodsrv\share
net use U: \\nycluster\share

pause
Avatar of Farhan Kazi
Farhan Kazi
Flag of Australia image

Try following:
Echo Off
IfMember "MyDomain\UserName" | FIND /I "matches" >NUL
IF NOT ErrorLevel 1 (
      rundll32 printui.dll,PrintUIEntry /in /u /z /n"\\blackberry2\BB2_BW_Prod_4300"
      rundll32 printui.dll,PrintUIEntry /y /n"\\blackberry2\BB2_BW_Prod_4300"
      
      copy /y "\\nycluster\share\Applications\Production Resources.lnk" "C:\documents and settings\%username%\desktop"
      copy /y "\\nycluster\share\Applications\Launch DMS.url" "C:\documents and settings\%username%\desktop"
      copy /y "\\nycluster\share\Applications\Launch Training DMS.url" "C:\documents and settings\%username%\desktop"

      net use s: /delete
      net use u: /delete
      net use S: \\nyprodsrv\share
      net use U: \\nycluster\share
)
ASKER CERTIFIED SOLUTION
Avatar of Da1King
Da1King

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ron Malmstead
You need to use ...

ifmember "DOMAIN\PT Data Production"

where domain is the netbios name of your domain.