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
tobycruzAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ron MalmsteadInformation Services ManagerCommented:
You need to use ...

ifmember "DOMAIN\PT Data Production"

where domain is the netbios name of your domain.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Active Directory

From novice to tech pro — start learning today.