Link to home
Start Free TrialLog in
Avatar of mystikal1000
mystikal1000

asked on

Batch File: Auto login in Novell doesn't always worked.

For some reason my batch file doesn't work all of the time.  It brings up a Novell Login box, but it doesn't automatically login.  Sometimes I have to manually click the 'OK' box.  Does anyone have any suggestions so it will work automatically?

 @echo off
echo.

if exist \\server1\test1\*.* goto MAPME
  loginw32 somsc/%username% /pwd test /ns /tr

  echo Checking Network Rights, Please wait ù ù ù
  echo.

  if exist \\server1\test1\*.* goto MAPME
    echo.
    echo ****   Error.  Global Connection Failed!   ****
    echo           Drive G: can NOT be Mapped.
    echo.
    pause
    goto QUIT

:MAPME
  if exist G:\test1\nul goto QUIT
    if exist G:\nul net use G: /delete /yes
    net use G: \\server1\test1 /persistent:no

:QUIT
Avatar of Joseph O'Loughlin
Joseph O'Loughlin
Flag of Ireland image

Hi mystikal1000,
The script only attemts to log you in if there has not been a previous authentication to the server, so move the login attempt to directly after @echo off
usual disclaimers apply
Avatar of mystikal1000
mystikal1000

ASKER

I am not sure what you mean by that.  I thought this has been done above?
Hi,
The line
if exist \\server1\test1\*.* goto MAPME
skips the login step if there are already credentials that allow test1 to be accessed
Should I include if exist \\server1\test1\*.* goto MAPME ?
Yes, the 2nd time.  No need for it twice
Why do you think that is the cause of my problem?
I have a suggestion...if you're ultimately trying to map G - try it this way - kind of backwards, but saves on useless processing...

@echo off
:start

if exist g:\nul goto G_Chk
::if G is already mapped, make sure it's mapped properly
::if G is not mapped, check share presence

if not exist \\server1\test1\* goto Login
goto G_Chk
 
:Login
loginw32 somsc/%username% /pwd test /ns /tr
goto start

:G_Chk
  if exist G:\test1\nul goto QUIT
  net use G: /delete /yes
  net use G: \\server1\test1
  if errorlevel==0 goto QUIT
  cls
  echo. Unable to connect.
  echo.
  echo. Press Ctrl + C to abort.  
  echo. To retry -
  pause
  goto start

:QUIT
What makes you think this batch file will work better, Sirbounty?
Sir Bounty's batch file makes fewer assumptions.
For example it would cope with the drive connection being cached from when an notebook was last on the network.
It accomplishes the implied objectives faster, without authenticating to the server when not needed.
I ran the batch file and it doesn't automatically login from the netware login screen, you have to click 'ok' to login.
Try a 2nd time.  Try when disconnected.  Try when loged in as someone else.  What permutations prompt?
ASKER CERTIFIED SOLUTION
Avatar of Joseph O'Loughlin
Joseph O'Loughlin
Flag of Ireland image

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
somsc is the tree.  What else to try?
Forget about the rest of the batch file.  Try the line
loginw32 somsc/%username% /pwd test /ns /tr
on it's own.  Is there any pattern to when it asks for the <ok> conformation?
In those circumstances try
loginw32 somsc/%username% /ns /tr somec /pwd test
If the same problem results are the users in question in the same or different OUs?
It looks like the addition /cont fixed the issue.  Thanks for your help everyone.