; 7777.KIX
; KiXtart script to map network drives
;Variables
;Get the hostname of the server that served the logon request
;IE this should be the local domain controller, if in a domain environment
$strLogonServer = @LSERVER
;Get the domain name, rather than declaring it explicitly.
;This way script wont break if domain renamed or something
$strDomain = @DOMAIN
;Determine the Site Code.
;Do this by making the variable $strSiteCode equal to the
;first 4 characters of the $strLogonServer variable
$strSiteCode = Left($strLogonServer,4)
;Lets build a site-specific string equal to the name of the file server\share
$strSomeFileShare = "\\" + $strSiteCode + "FNP01\SomeShare"
;Delete some mappings, display error codes.
; This would really be best as a function, but best to keep it simple
; while learning
use i: /delete /persistent
? "i: - Error (" + @error + ") SERROR(" + @SERROR + ")"
use g: /delete /persistent
? "g: - Error (" + @error + ") SERROR(" + @SERROR + ")"
use m: /delete /persistent
? "m: - Error (" + @error + ") SERROR(" + @SERROR + ")"
use s: /delete /persistent
? "s: - Error (" + @error + ") SERROR(" + @SERROR + ")"
;Presumably you will want to map a drive(s). lets map it to z:\
mapdrive($strSomeFileShare, "z:")
;To prevent the script from closing the second
;it has completed, and thereby not giving
;us a chance to see the output, we can tell it to
;wait for the user to press a key before continuing/closing
;This should be removed before production, but handy for testing
Get $
;---------------------
;Function to Map a Drive
;---------------------
Function mapdrive($drivepath, $driveletter)
Use $driveletter $drivepath
If @ERROR = 0
? "Drive: " $drivepath " was mapped successfully"
Else
? "Drive ( " + $drivepath + " ) was NOT mapped!"
? "Error: " + @SERROR
EndIf
EndFunction