Discussion Locked

Batch files(Shell scripts)

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

As a novice in batch files & shell scripting,I have learnt so participating on this site.As a Practice routine I have implemented a basic script to map net drive for nt40 & win95.here is the script i wrote
@echo off
rem xxxxx Unilogin Script.
if "%os% =="windows_nt" goto nt40
set os =windows 95
rem xxxxxxx This is for win95
net use R: \\sfopdc\Hhr$Docs
:nt40
net use R: /delete
net use Z: /delete
rem xxxxxxxxxxx
net use R: \\sfopdc\Hr$docs
net use z: \\sfopdc\Reports
end
I have read you could place the ifmember.exe into the scripts as well to assign by group membership.Can someone help me on that one.Should I copy the ifmember.exe into the scripts dir and run like this in the beginning of my scripts
@echo off
I do not know to insert in my script.Lost.Can someone throw one of their scripts for ifmember.exe
ALSO IN THE FIRST Script where set os =windows 95
That portion of the script does not execute,although the user has the home folder setting ok because it was assigned through user profiles.how can I include the ifmember without drive mapping to copy on clients pc.Thanx so much
Aziz

6 replies

by tamj123

@echo off
U:

net time \\ny-prt /set /y

:NYUSERS
\\ny-prt\NETLOGON\IFMEMBER.EXE NNI\NYUSERS
IF NOT ERRORLEVEL 1 GOTO VA
net use J: \\NY-NNI\DEPT /persistent:NO
net use R: \\NY-NNI\APPS /persistent:NO
net use S: \\NY-NNI\SHARED /persistent:NO
net use t: \\NY-NNI\vatran$ /persistent:NO
net use h: \\nvan004\shared /persistant:NO

this is part of my batch files, hope it will help you.

by highorbit

I recommend you have a look at Kixtart, it's included on the NT Resource kit. It's far more flexible than the batch file method.

Has a command if ingroup("name") etc which seems appropriate.

Latest version, manuals and information is availableat www.kixtart.org

Cheers

by shanghai sam

First, there are a bunch of variables that do not exist in Win95/98: %UserName% %OS% %UserDomain% %ComputerName%. None of these exist in it. So, you are correct for building the %os% for the Win95 clients.
Now, I tried running this on a Win98 box.I am hoping it is not that different from Win95.
To get the Set OS line to work in Win98, I had to remove all spaces:
SET OS=WINDOWS_95
That was the only way it would work. In doing that, it then worked. This includes the spaces on either side ofthe equal sign. Don't ask me why! But it works with no spaces. Now, the variable will only be in existence while the logon script is running. If you do a SET once the script is done, your Win95 box will not have the OS variable, but it IS there during the script. I did a ECHO %OS% after SETting it, and it displayed correctly, plus the rest of the script logic worked correctly.

Next, IFMEMBER.EXE is NOT going to work on the Win95 box. YOu are just gonna get some errors. So, don't try and run it in the Win95 section.

To use it for the NT/2000 clients, first copy IFMEMBER.EXE into the Netlogon share folder on your PDC/BDCs. Then, have the syntax like this:

IFMEMBER MYDOMAIN\ACCOUNTING
if errorlevel 1 goto ACC
echo not ACCOUNTING
IFMEMBER "MYDOMAIN\Domain Admins"
echo %errorlevel%
if errorlevel 1 goto DA
echo not domain\domain admins
IFMEMBER Everyone
echo %errorlevel%
if errorlevel 1 goto Every
echo not Everyone
EXIT

:DA
echo Administrators group
NET USE x: \\Server1\adminshare
EXIT
:Acc
echo Accounting group
NET USE X: \\Server1\accshare
EXIT
:Every
echo Everyone group
NET USE x: \\Server1\Allshare
EXIT

by joseph moore

Part 2

So, in this example, I am saying that if the IFMEMBER reveals that the user is a member of one of those three groups, to go to the associated procedure, display a little message saying what group they belong to, then map drive X: to a specific location. So, if they are only a member of the Everyone group, the first two IFMEMBER sections will not execute; the user will only get the two Not member messages I put in. They will then hit the third IFMEMBER, which will be true, and it will map X: to the allshare.
This is just an example of some of the IFMEMBER syntax.

Hope this helps.

by azizhakim

I did as user deleted suggested but no cooperation on win95 part.ALSO I MADE AN ERROR AS O HOME DIR.WIN95 CLIENTS CANNOT ATTACH TO HOME FOLDER AS SPECIFIED IN PROFILES? ANY MORE THOUGHTS

This discussion is closed to new replies.