LOST

B

Brad

ok I am kinda new at scripting So I am using the ifmember
command to try create a login script that will map network
drives to certain groups such as:admin/user/finance..ect

The syntax may be wrong unsure of how to proceed
ifmember Administrator
if not erorlevel 1 goto end
net use X: \\servername\sharename
end

I have a stack of books but for us newbies it doent seem
real clear on what i can do to get this stuff to work.
any input help or advice greatly appriciated
 
M

Matthias Tacke

Brad said:
ok I am kinda new at scripting So I am using the ifmember
command to try create a login script that will map network
drives to certain groups such as:admin/user/finance..ect

The syntax may be wrong unsure of how to proceed
ifmember Administrator
if not erorlevel 1 goto end
net use X: \\servername\sharename
end

Only 2 two things write the NOT in uppercase
and use goto :EOF
Labels need to be preceeded by a colon, the label
:EOF exists in every case doesn't need to be defined.
But it is very useful for subroutines.
I just installed ifmember, don't kmow if you need a full path.

=======================================
ifmember Administrator
if NOT erorlevel 1 goto :EOF
net use X: \\servername\sharename
=======================================

hth
Matthias
 
A

Al Dunbar [MS-MVP]

Matthias Tacke said:
Only 2 two things write the NOT in uppercase

This is necessary? I never use uppercase NOT - EQU, NEQ, LSS, and etc, yes
(in NT4, anyway).
and use goto :EOF

Depends on whether that is ALL there is in the script. What if he wants to
test membership in some other group following the :END label? Once you
goto:EOF, there is no going back ;-)
Labels need to be preceeded by a colon, the label
:EOF exists in every case doesn't need to be defined.
But it is very useful for subroutines.
I just installed ifmember, don't kmow if you need a full path.

=======================================
ifmember Administrator
if NOT erorlevel 1 goto :EOF
net use X: \\servername\sharename
=======================================

I forget what ifmember returns to indicate membership, errorlevel 1 or 0.
But this above code, if correct, could be alternately done like this:

ifmember administrator
if errorlevel 1 net use x: \\svr\shr
ifmember group1
if errorlevel 1 net use y: \\svr\grp2

etc...

/Al
 
M

Matthias Tacke

Al Dunbar said:
This is necessary? I never use uppercase NOT - EQU, NEQ, LSS, and etc,
yes(in NT4, anyway).

You are right, but there are OS before and according to some
postings in a.m.b problems can arise from lower/mixed case. And
have a look at "IF /?" In _my_ helpscreen the NOT and other
comparison operators are all in uppercase.
Depends on whether that is ALL there is in the script. What if he wants to
test membership in some other group following the :END label? Once you
goto:EOF, there is no going back ;-)
Also right, the main point for me was the missing colon and the fact
that a label to exit isn't necessary. And it was his example
I should have noticed that there is a missing r in er_orlevel !
I didn't a full install of the reskit and don't know if
"%ProgramFiles%\Resource Kit" is added to the search path.

Matthias
 
M

Michael Bednarek

ok I am kinda new at scripting So I am using the ifmember
command to try create a login script that will map network
drives to certain groups such as:admin/user/finance..ect

The syntax may be wrong unsure of how to proceed
ifmember Administrator
if not erorlevel 1 goto end
^
Try: errorlevel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top