lakn
(Fresh Scripter)
2007-06-14 02:35 PM
AD login script which maps network drives

Hi,
Is it possible to create a kix script that map networkdrives in a way so that they reconnect at each logon? (like the option "reconnect at logon" when you manually map a drive)
We are currently running this logon script, but lately it has been nothing but trouble. What I need is a kix script to map all the drives with reconnect at logon, so I can run this once on each client, instead of having to do it manually on each computer. Is that possible?

 Code:
 
;
;  KIXTART.SCR
;
;  Bioimage Kixtart Logon script ver. 1.7
;

CLS
;SetTime "\\Vale"

;AT (1,1)@userid              ; ...and some macro's
;AT (2,1)@fullname
;AT (3,1)@wksta
;AT (4,1)@lserver
;AT (5,1)@INWIN 

; Mapping Std. drive to everybody

Use "*" /Delete 					; Delete all mappings

;Bohr
Use L: "\\Bohr\Programs$"				; Maps Programs Drive
Use M: "\\bohr\Compound$" 				; Maps Incell Data
Use N: "\\bohr\AssayDev$" 				; Maps Incell Data
Use O: "\\Bohr\Swapzone"				; Maps the SwapZone
Use P: "\\Bohr\@userID$" 				; Maps the Personal drive
Use Q: "\\Bohr\Projects$"				; Maps Project drive
Use R: "\\Bohr\Functions$"				; Maps Functions drive
Use T: "\\Bohr\Templates$"				; Maps Templates drive

;Armenius
Use U: "\\Armenius\Compound_data"			; Maps Compound_data på Armenius
Use Y: "\\Armenius\Assay_development_data"		; Maps Assay data drive
Use Z: "\\Armenius\Docstore$"				; Maps the Docstore drive
Use I: "\\Armenius\BioImage Procedure Library (BIPL)" 	; Maps the New SOP-File drive

If @userid ='Jadc'
	Use V: "\\Bohr\software$" 			; Maps Software drive for specific users
EndIf

If @userid ='LaKN'
	Use V: "\\Bohr\software$" 			; Maps Software drive for specific users
EndIf

If @INWIN = 2
	;Use W: "\\Thor\win98$"
	Use Y: "\\Armenius\assay_Data"
	Use J: "\\Armenius\comdata"
EndIf

If @wksta = LSM_MICRO
	Goto End
EndIf

If @wksta = INcell_PC
	Goto End
EndIf

If @wksta = ALPHA5
	Goto End
EndIf

if @wksta = zymark
	Goto End
Endif

; Antivirus

If @WKSTA = odin
	Goto end
Else
	Goto Thor
EndIf

:Thor
If @WKSTA = Thor
	Goto end
Else
	Goto Bohr
EndIf

:Bohr
If @WKSTA = Bohr
	Goto end
Else
	Goto Armenius
EndIf

:Armenius
If @WKSTA = Armenius
	Goto end
Else
	Goto end
EndIf
:end
Cookie1


Les
(KiX Master)
2007-06-14 02:43 PM
Re: AD login script which maps network drives

/persistent

lakn
(Fresh Scripter)
2007-06-15 12:47 PM
Re: AD login script which maps network drives

So, for instance:

Use L /persistent: "\\Bohr\Programs$"

?

Thank you in advance \:\)


Richard H.Administrator
(KiX Supporter)
2007-06-15 12:55 PM
Re: AD login script which maps network drives

Yes that's right, though more usually like this:
 Code:
USE "L:" "\\Bohr\Programs$$" /PERSISTENT


lakn
(Fresh Scripter)
2007-06-15 01:24 PM
Re: AD login script which maps network drives

Thank you both. I will give it a try \:\)

lakn
(Fresh Scripter)
2007-06-15 01:58 PM
Re: AD login script which maps network drives

Hi Again \:\)
Is it possible to create a condition for mapping the drives, like if the drive "L:" is allready mapped -> do nothing, else USE "L:" "\\Bohr\Programs$$" /PERSISTENT? If so could anybody show me for one of the drives?
Regards
Lars Kragh


Mart
(KiX Supporter)
2007-06-15 02:07 PM
Re: AD login script which maps network drives

Sure. You could do something like the code below. Be careful because it could be that the mapped drive points to the wrong share. Just deleting all drives you want to map would be my choice.

 Code:
Break on

If Exist("L:\")
	?"Yep"
Else
	?"Nope"
EndIf


lakn
(Fresh Scripter)
2007-06-15 02:16 PM
Re: AD login script which maps network drives

Hi Mart,
Sounds good. What you mean is, if someone allready has a drive mapped as "L" from a different network connection?
So where should the USE "L:" "\\Bohr\Programs$$" /PERSISTENT go? (sorry, but im a coding retard)


Mart
(KiX Supporter)
2007-06-15 02:19 PM
Re: AD login script which maps network drives

Remove ?"nope"and put the code to map the drive there.

lakn
(Fresh Scripter)
2007-06-15 02:42 PM
Re: AD login script which maps network drives

Hi,
No, what I mean is, how would the code look like for checking if a drive letter is allready mapped and if not, map the drive persistent. Could you write a full example of this?


Les
(KiX Master)
2007-06-15 02:58 PM
Re: AD login script which maps network drives

 Code:
If Not Exist('L:\')
  Use 'L:' '\\Bohr\Programs$$' /persistent
EndIf


lakn
(Fresh Scripter)
2007-06-15 03:11 PM
Re: AD login script which maps network drives

Thank you Les!

Mart
(KiX Supporter)
2007-06-15 03:20 PM
Re: AD login script which maps network drives

 Originally Posted By: lakn

....
Could you write a full example of this?


I don't get it. What is so difficult about replacing one line with an other line?
You'll learn kixtart by using kixtart and coding (at least trying to code) what you want. Silver platters are nice but do you really know what the stuff on the silver platter does and how to modify it if it does not fully fit your needs? I guess not.

I’m not trying to put you down especially because you are new to this board and I don’t know your kixtart skills but I assumed that copying and pasting one line of code would not be that hard.
Anyway, if you have any more question don’t be afraid to ask.


Arend_
(MM club member)
2007-06-15 04:54 PM
Re: AD login script which maps network drives

 Originally Posted By: Mart
 Originally Posted By: lakn

....
Could you write a full example of this?

I don't get it. What is so difficult about replacing one line with an other line?
You'll learn kixtart by using kixtart and coding (at least trying to code) what you want. Silver platters are nice but do you really know what the stuff on the silver platter does and how to modify it if it does not fully fit your needs? I guess not.

I’m not trying to put you down especially because you are new to this board and I don’t know your kixtart skills but I assumed that copying and pasting one line of code would not be that hard.
Anyway, if you have any more question don’t be afraid to ask.


With some ppl it takes longer to get, some of them might be under stress that it needs to be done within a certain amount of time and therefore have no time to figure it out themselves. I don't agree with those motives but they are motives used by alot of ppl nonetheless, asking for help usually is asking for an answer not a "how to" to get there \:\)

However personally I do agree with you.


lakn
(Fresh Scripter)
2007-06-18 10:45 AM
Re: AD login script which maps network drives

Hi,
I aggree with both of you and I am sorry. Its all about learning and not copy/pasting. The thing is, as apronk so kindly said, I didnt have time to learn how to code Kixtart. I needed to modify an active directory script, that a former employee made years back and then never touch it again (crossed fingers). Anyways, I thank you all for the help. Next time I won't ask for the full solution.