?
Solved

Login Script: Advanced Run External Program

Posted on 2005-05-17
23
Medium Priority
?
1,140 Views
Last Modified: 2008-01-09
We are using Netware 5.1 and the 4.90.0.0 SP1a client. We also run AD with Windows 2003 servers. We use Novell primarily as a file sharing service but we are gradually switching over to Windows. I know how to map a MS share from the novell login script using the " @net use" command but it throws up a big DOS window that users have a tendancy to close since it takes a few seconds for the drive to map. If they close it then the drives do not get mapped and that's a problem.

I am looking for a more advanced way of mapping the MS share from the novell login script. Preferably there would be some option that would make the DOS window run minimized, or at the very least let me echo "Mapping drives, Do Not Close" to it so they don't close it.

I tried [@"Mapping drives, Do Not Close" && net use \\server\share] which would work in a command window but I realized its not a command window, its running executables only. Could I make a batch file on a MS server and execute it minimized? What would the syntax look like for that?

I know I could just map the drives using a MS login script but then we would have two scripts to maintain in two different locations instead of one.

Thanks!
0
Comment
Question by:tommyboy22481
  • 9
  • 7
  • 6
  • +1
23 Comments
 
LVL 34

Expert Comment

by:PsiCop
ID: 14020572
Sorry to hear you're moving to a platform that will increase your IT costs, limit your technology options, and provide less-reliable services. Doesn't sound like a good business decision to me, but who knows, mebbe your company's competitors are making smarter business moves.

Why not simply implement Native File Access Protocols (NFAP) on the NetWare v5.1 server? This was introduced in NetWare v6, but a backport was made freely available to licensed v5.1 networks. Think of it as "Samba for NetWare" - it allows a NetWare server to appear as a CIFS server to Windoze clients (just minus the BSODs).
0
 
LVL 35

Expert Comment

by:ShineOn
ID: 14020645
Have you tried using the # instead of the @?

You could create a batch file that is called but if the command prompt PIF isn't set for running minimized, they'd still get a window.

If you are using newer windows client PC's you could probably use wirdows scripting and call that instead.

If it takes so long to map a drive with net use, that should tell you something, though.  You do realize of course, that Windows - even Windows 2003 server, has only a crude subset of NetWare's filesystem security, and the ACL inheritance isn't dynamic from the directory down meaning the user sees all of the directories and subdirectories rather than just what they're given rights to?  That NetWare still beats Windows, even Windows 2003, in file and print serving?  That it takes 2-3 multiprocessor Windows servers to do the work of one, uniprocessor NetWare server?  That when LongWait finally gets released, in order to use the version of AD that ships with LongWait's server version, you'll need to do a wholsale upgrade of all of your Windows AD controller servers?  And that means you'll have to upgrade all of your user CALs to the LongWait CAL, at full price, if you didn't subscribe to a SA contract?  That Active Directory is still playing catch-up to eDirectory/NDS, and there is no indication that Microsoft will ever make a non-Windows version of Active Directory while eDirectory runs on all flavors of Windows server on the NT4 and above kernel, NetWare 5.1, 6.x and beyond, several flavors of Linux, Solaris, AIX, HP-UX, and more?
0
 

Author Comment

by:tommyboy22481
ID: 14021243
Moving to windows is not my choice rather a Government mandate. I don't care which way we go I just want them to choose one and stick with it, supporting two seperate systems is such a pain. Either way I can't change what we use so let's get back to my question please?

Using # would only slow things down since they would have to wait for the mapping to finish to continue with the rest of the script.

I don't want to use windows scripting because then I would have to maintain two seperate login scripts. There are several other people that maintain the network so the simpler the better.

Can anyone give me an example of running a batch file from an MS share? Would something like this work? @\\server\share\path\filename.bat  
Is there any way to get that to run minimized?

NFAP sounds interesting, I would love to get rid of the novell client entirely and just use AD. I could move the novell login script to a windows login script and streamline the whole process. Would I have to join the Novell server to AD in order for the users to authenticate or would I still need the novell client for that?
0
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 
LVL 35

Expert Comment

by:ShineOn
ID: 14021387
Cant you call the .wsh file from the NetWare login script just like you'd call a .bat file or any other external executable filetype?

I believe NFAP/CIFS server can join a traditional NT4 domain.  I don't know if it can join an AD domain.  The users will still have to be in both environments, because the filesystem rights will still be controlled in the NetWare/NDS environment.
0
 
LVL 35

Expert Comment

by:ShineOn
ID: 14021404
Government mandate to use Windows.  No wonder we've got deficits. ;D
0
 
LVL 35

Expert Comment

by:ShineOn
ID: 14021413
Maybe that's where the "good enough for Government work" phrase came from ;D
0
 

Author Comment

by:tommyboy22481
ID: 14021458
NFAP is good to know about but I don't think its what I need in this situation.

Running a .WSH actually might work, no DOS window involved. For some reason I didn't think about that. Not quite as simple as I would like since its a seperate file to maintain but its better than what we are doing now.

Do I have to run a Novell server to create a novell share? Could I somehow create a Novell Share on the MS 2003 box then just use the regular Novell MAP command? It's actually a DFS share replicated across 3 servers, how would I make that visible to Novell?
0
 
LVL 35

Expert Comment

by:ShineOn
ID: 14021794
To be honest, I've never looked into login script processing using clientless login to NFAP/CIFS, so I don't know if you can use a NetWare login script to map any CIFS/SMB share.  Since you need the Novell client to process the NetWare login script, I would think you'd have to do a NET USE to map an NFAP/CIFS share just like you would with a Windoze share.  

If that's the case, then you could transition to using Windoze-based login scripts with a NET USE for the NFAP/CIFS shares.  You'd just have to figure out how to only use the Windoze login scrpt for those PC's that have had the Novell client removed.

 I don't know to what extent NSS on NetWare 5.1 uses DFS, and I don't even know that the DFS support in NSS on modern NetWare can work as part of a Windoze DFS share.
0
 
LVL 19

Expert Comment

by:billmercer
ID: 14028471
I had a similar problem trying to map a drive to a samba share on my linux box.

Here's a very simplistic AutoIt3 script to map a drive letter.

Compile it to an executable, stick that in the \\sys\login folder and run it from the login script. It works pretty well. You can tart it up with lots of bells and whistles, error checking, etc.
 

; Simple AutoIt script to map an SMB share with a simple progress dialog.
; public domain, no copyright

$UNCPath = "\\server\share"
$DriveLetter = "U:"
$i = 0 ;
$status =  0
$timeout = 1000


ProgressOn("Please wait...", "Mapping network drives") ;

DriveMapAdd($DriveLetter, $UNCPath )  ; Map the drive letters

do
   ProgressSet( 50, "Waiting for network drive...") ;

until FileExists("U:\")

ProgressSet( 100, "Done...");
Sleep(100)   ;
ProgressOff();







0
 

Author Comment

by:tommyboy22481
ID: 14030239
Kudos for using AutoIt, I love that software. I didn't realize there was a new version out either, the GUI stuff should be really fun to play with. I think I am going to go with the WSH script though, not many people know about AutoIt yet and that makes it harder to maintain.
0
 

Author Comment

by:tommyboy22481
ID: 14030752
>
> Cant you call the .wsh file from the NetWare login script just like you'd call a .bat file or any other external executable filetype?
>

I tried running a .VBS file and it didn't work, will it work with a WSH file?
0
 

Author Comment

by:tommyboy22481
ID: 14030934
whoops, I forgot the cscript  before the VBS path whish is why it didn't work. Unfortunatly a DOS box is still open in the background while the VBS file runs so it's no better solution than before.

Actually the best option so far is the AutoIt script, the DOS box is still launched (I don't think there's any way to get around the DOS window) but it disappeares right away and the AutoIt App continues to run. It's a huge pain to maintain though since it need to be compiled again whenever there's a change.

I think I'm pretty much stuck, there seems to be no way to get rid of the DOS windows when running an external program.

So I can:

    1: Leave it as is, just tell users not to close ODS window
    2: Map the drives using a GPO, but that creates a second script to maintain
    3: Write an AutoIt program that maps the drives, which is even harder to maintain than a GPO script

For right now I guess I'm going with option 1, it's the easiest to maintain though its the ugliest implimentation for the users.

Unless someone can offer a way around the DOS window I think I'm going to have to ask for a points refund since no one could really offer a solution.
0
 
LVL 35

Expert Comment

by:ShineOn
ID: 14031224
If Windows Scripting Host is running on the PC's, then a .WSH file *should* work, IMO.  I don't know, 'cause I don't have to do it, so I've never tried, but it makes sense to me that it would.
0
 

Author Comment

by:tommyboy22481
ID: 14031276
I think it would, but it would still be launched in a DOS window so that doesn't help any.
0
 
LVL 35

Expert Comment

by:ShineOn
ID: 14031316
Crap.  Oh, well, we tried...
0
 
LVL 19

Accepted Solution

by:
billmercer earned 500 total points
ID: 14031544
If you compile the AutoIt script into an executable, there's no DOS prompt, it just runs like any other executable.
There's no need to recompile the AutoIt utility, simply create a script that reads the parameters from the command line, like this:

; Simple AutoIt script to map an arbitrary share to an arbitrary drive letter

$Result = 0
if $CmdLine[0] = 2 then
  $DriveLetter = stringleft($CmdLine[1],1) & ":"     ; Take first character from first parameter as drive letter
  $UNCPath =  $CmdLine[2]                            ; Take second parameter as path to share
  DriveMapAdd($DriveLetter, $UNCPath )               ; Map the drive letter to the path
  $Result = @error                                   ; capture error status
  if $Result <> 0 then
     MsgBox(0,"Error...", "Error mapping drive " & $Driveletter & " to path " & $UNCPath & ". Error Number " & $Result )
  endif
else
  MsgBox(0,"Usage","DriveMap.exe X: \\SERVERNAME\SHARENAME") ; prompt for proper usage if no/incorrect parameters supplied
 
endif



Then put a line like this in your login script...

# drivemap.exe X: \\myserver\myshare
0
 
LVL 19

Expert Comment

by:billmercer
ID: 14031572
If you want to give it a try, here's a compiled executable version of the above script.
 
http://www.milleniumhandandshrimp.com/upload/drivemap.exe

0
 

Author Comment

by:tommyboy22481
ID: 14032259
Passing in the drive mapping from the script is something I hadn't thought of at all, I was thinking maybe reading the mapping in from text file but this is much better. Launching an executable DOES  open a DOS window but it merly flashes on the screen for a second so its much less obtrusive. Also since the mappings are in the Novell login script itself it becomes much easier to maintain.

I will test this tomorrow, but I think we have a winner!
0
 
LVL 19

Expert Comment

by:billmercer
ID: 14032377
Could it be there's something else in your login script causing the DOS box to appear?  When I run an executable in my login script with the # prefix, there's no DOS window at all, not even a hidden one.  Maybe it's due to differences in our clients and platforms or something.
0
 

Author Comment

by:tommyboy22481
ID: 14032420
Maybe, I'm using Netware 5.1 with 4.9 client on windows XP SP2 machines. I have been using the @ sign instead of the # because I thought the only difference between the two was that # launches the external program then waits for it to finish before continuing the rest of the Novell script while the @ launches the external program then continues without waiting.

I will try it the other way and see what happens. Is it possible that this is configurable on the Novell server somewhere?
0
 
LVL 19

Expert Comment

by:billmercer
ID: 14032511
Hmm, I'm using Netware 6, but everything else is the same, and I'm pretty sure this worked the same when I was still on 5.
I doubt there's a server setting for this, it seems more like a client function. But I don't know for sure.
Maybe something else in the environment is different, possibly related to your mixed-platform environment. Maybe using @
spawns a new process via command prompt or something. I'll fart around with it and see if I notice a difference.


0
 

Author Comment

by:tommyboy22481
ID: 14039393
I tried this today and it worked great! For some reason I am still getting the DOS window for a second but other than that it's perfect. Using # or @ doesn't seem to make any difference. Thanks for the help!!
0
 
LVL 19

Expert Comment

by:billmercer
ID: 14039709
You're welcome!
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Applications for our next round of the Experts Exchange Scholarship Contest are starting to roll in. It made us wonder what our past winners are up to these days. Here's a look at what four winners experienced with the contest and what they're doing…
LinkedIn blogging is great for networking, building up an audience, and expanding your influence as well. However, if you want to achieve these results, you need to work really hard to make your post worth liking and sharing. Here are 4 tips that ca…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question