#33299 - 2002-11-22 10:32 PM
Script not running....
|
Nick O'Connor
Fresh Scripter
Registered: 2002-11-22
Posts: 12
|
So I got the environment variable part figured out.
If I run the script (which is launched via batch file) directly by mapping to the netlogon share, it works great.
If I just log the user in and expect it to run, I get an error from kixstart32.exe that it cannot find the script.
This is a 95 machine.
I have tried the script with both file extensions. (*.scr, and *.kix)
The login batch file: login.bat
@ECHO OFF Z:\KIX32.EXE envar.scr (This is where I get the error) net use h: /delete net use h: "\\server\%username%$" EXIT
envar.scr
? "Creating local user environment....." SHELL "winset.exe USERNAME=@USERID" Call envarmacro.bat EXIT
envarmacro.bat
SHELL "winset.exe USERNAME=@USERID" EXIT
|
|
Top
|
|
|
|
#33307 - 2002-11-25 03:18 PM
Re: Script not running....
|
Nick O'Connor
Fresh Scripter
Registered: 2002-11-22
Posts: 12
|
First off...
I am trying to set the environment variable for %username$ so that I can use that variable to map user home directories on Win9x.
I am using the latest version of Kix.
So if I understand correctly you are suggesting that I do that mapping in the actual Kix script?
Would that mean I would not need the third file at all then? I would prefer to run it all in one file if at all possible. The suggestion provided by Lonkero above, worked in that it ran and set the variable, but still did not map the drive.
I think this is because the script had not exited by the time the variable was set. [ 25. November 2002, 15:24: Message edited by: Nick O'Connor ]
|
|
Top
|
|
|
|
#33308 - 2002-11-25 03:25 PM
Re: Script not running....
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Map the all drives inside your KiXtart script. No need to set environment variables.
code:
If @Homeshr<>"" Dim $x $x=Substr($Homeshr,3,len($Homeshr)-2) $Hserver=Substr($x,1,instr($x,"\")-1) $UserShare=Substr($x,instr($x,"\")+1,len($x)-instr($x,"\")) Endif If $HomeDrive<>"" and $Hserver<>"" and $UserShare<>"" MapDrive($HomeDrive, $Hserver, $UserShare) else Writelog("Home drive is either not defined or improperly defined for this user: Drive='" + $HomeDrive + "', Server='" + $Hserver + "', Share='" + $UserShare + "'") endif
Function MapDrive($Drive, $Server, $Share) Dim $Drive, $Server, $Share Color c+/n If $Drive<>"" and $Server<>"" and $Share<>"" $LogText="Connecting $Drive to \\$Server\$Share" ? $LogText USE $Drive /Delete /Persistent USE $Drive "\\$Server\$Share" If @error=0 color g+/n $x=" - Success" "$x" Else color r+/n $x=" - Failed: Error @error" "$x" $ErrorState=1 Endif WriteLog ($LogText + $x) Color w+/n Else WriteLog ("Function 'MapDrive' called with invalid parameters: '$Drive', '$Server', '$Share'") Endif Endfunction
|
|
Top
|
|
|
|
#33309 - 2002-11-25 03:35 PM
Re: Script not running....
|
Nick O'Connor
Fresh Scripter
Registered: 2002-11-22
Posts: 12
|
Apparently I am a moron, because that script makes zero sense to me.
I would assume you would call it from a login.bat file. Other than that, you totally lost me.
The method I have almost works, but not quite. Once the script stops running, I can map using the variable. But it will not map until the script ends.
I would love to try this one you provided, but not sure how to set it up.
Nor do I see how it helps me when the name of the share is \\server\username$ [ 25. November 2002, 15:54: Message edited by: Nick O'Connor ]
|
|
Top
|
|
|
|
#33310 - 2002-11-25 03:58 PM
Re: Script not running....
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
If you properly define the home share in the account properties as "\\server\account$", then the code I provided will look it up and parse the server and share from the string.
You then simply pass the values to the MapDrive function to map the drive.
Let me know if this makes more sense.
|
|
Top
|
|
|
|
#33311 - 2002-11-25 04:16 PM
Re: Script not running....
|
Nick O'Connor
Fresh Scripter
Registered: 2002-11-22
Posts: 12
|
Actually what works the best, and the simplest is what sealeapord suggested.
So the layout now is sipmly
login.bat
@ECHO OFF Z:\KIX32.EXE Z:\userhome.kix net use s: /delete net use p: /delete net use s: "\\server\share" net use p: "\\server\share2" EXIT
userhome.kix
? "Creating local user environment....." SHELL "winset.exe USERNAME=@USERID" use h: /delete /persistent use h: '\\server\'+@USERID+'$$' EXIT
Now comes the fun part. I have it working for that one department. Now I need to (Based on Group membership) alter the P and S drive mappings specified in the Login.bat file.
For example If you in HR, you need \\server\share1 and \\server\share2
If your in Finance you need \\server\share3 and \\server\share4 [ 25. November 2002, 16:18: Message edited by: Nick O'Connor ]
|
|
Top
|
|
|
|
#33313 - 2002-11-25 04:25 PM
Re: Script not running....
|
Nick O'Connor
Fresh Scripter
Registered: 2002-11-22
Posts: 12
|
I appreciate howards, but would like to keep it simple. At least I can decipher what is running now.
I just need to find a good IF MEMBER type function to add in there.
|
|
Top
|
|
|
|
#33316 - 2002-11-25 04:54 PM
Re: Script not running....
|
Nick O'Connor
Fresh Scripter
Registered: 2002-11-22
Posts: 12
|
Got it, thanks
Can you just list them? Like.....
? "Creating local user environment....." SHELL "winset.exe USERNAME=@USERID" use h: /delete /persistent use h: '\\mercy-file\'+@USERID+'$$' IF INGROUP("Groupname") USE P: '\\server\'share' USE S: '\\server\'share2' Endif EXIT
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 671 anonymous users online.
|
|
|