• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5840
  • Last Modified:

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
0
tobycruz
Asked:
tobycruz
1 Solution
 
Farhan KaziSystems EngineerCommented:
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
)
0
 
Da1KingCommented:
Looks like you aren't using the command correctly.  Try the following:

-----
ifmember "PT Data Production"
if not errorlevel 1 goto failure
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

failure:
-----

This added line was listed here: http://www.microsoft.com/technet/archive/winntas/tips/winntmag/grlogon.mspx?mfr=true
0
 
Ron MalmsteadInformation Services ManagerCommented:
You need to use ...

ifmember "DOMAIN\PT Data Production"

where domain is the netbios name of your domain.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now