Page 2 of 2 <12
Topic Options
#38106 - 2003-03-25 03:13 PM Re: HOW CAN I REMOVE/PREVENT DOUBLE DRIVEMAPPINGS?
Kris Offline
Fresh Scripter

Registered: 2003-03-20
Posts: 13
Loc: Belgium
Sorry for the term double drivemappings!!! IT IS WRONG!!!

EXACT DESCRIPTION OF THE PROBLEM:

Example: I am user TEST
user TEST logs on and has following groups

GLOBAL GROUPS: LOCAL GROUPS:
PRINTER1 LOCAL1
PRINTER2 LOCAL2
GLOBAL3 LOCAL3
GLOBAL4 LOCAL4

The script now will match groups and will try to make following printer connections:
\\LOCAL1\PRINTER1
\\LOCAL1\PRINTER2
\\LOCAL2\PRINTER1
\\LOCAL2\PRINTER2
\\LOCAL3\PRINTER1
\\LOCAL3\PRINTER2
\\LOCAL4\PRINTER1
\\LOCAL4\PRINTER2

It should only make connection to:
\\LOCAL1\PRINTER1
\\LOCAL2\PRINTER2

When ther is also a printque named printer2 on local 4, it will also map printer
\\LOCAL4\PRINTER2 whiwh is wrong !!!

This problem is the same for the drivemappings, In my script I have a "WERKGROUP" share, an "APPLICATION" share and a "PROJECT" share. For the same reasen, the script will for some users connect the apllication share in the project drive.

I THINK I HAVE TO MAKE AN ARRAY FOR EACH DRIVE INDEPENDENTLY TO SOLVE THIS PROBLEM BUT THAT'S TOO COMPLICATED FOR ME (been trying for days now... [Frown] and the printerproblem isn't solved yet as well... [Frown]

Top
#38107 - 2003-03-25 03:24 PM Re: HOW CAN I REMOVE/PREVENT DOUBLE DRIVEMAPPINGS?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Why don't you put the printerlist into a .INI file and use e.g. the global/local groups as section anmes to determine who's getting which printer. this will also make it easier to add/delete printers as only the .INI file and not the script itself need to be modified.
_________________________
There are two types of vessels, submarines and targets.

Top
#38108 - 2003-03-25 03:35 PM Re: HOW CAN I REMOVE/PREVENT DOUBLE DRIVEMAPPINGS?
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
How are these groups related Printer1 and Local1? You seem to confused yourself by enumerating ALL Global groups and then ALL local groups. The only place I see any relationship is when you look for global groups inside of local groups.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#38109 - 2003-03-25 03:42 PM Re: HOW CAN I REMOVE/PREVENT DOUBLE DRIVEMAPPINGS?
Kris Offline
Fresh Scripter

Registered: 2003-03-20
Posts: 13
Loc: Belgium
Howard,

Off course it first checks local groups and then global groups that are in the local groups and the table I showed was the result of the search.

Top
#38110 - 2003-03-25 04:00 PM Re: HOW CAN I REMOVE/PREVENT DOUBLE DRIVEMAPPINGS?
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Where do these local group live? Are they Domain local groups or group on a server?
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#38111 - 2003-03-25 04:03 PM Re: HOW CAN I REMOVE/PREVENT DOUBLE DRIVEMAPPINGS?
Kris Offline
Fresh Scripter

Registered: 2003-03-20
Posts: 13
Loc: Belgium
Howard,

We work with domain local groups in a trusted/trusting multi-domain environment.

Top
#38112 - 2003-03-25 04:21 PM Re: HOW CAN I REMOVE/PREVENT DOUBLE DRIVEMAPPINGS?
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Please review this code. I think that it comes very close to what you want to accomplish.

code:
Dim $LTeller, $LGroup
$LTeller = 0
Do
$LGroup = EnumLocalGroup($LTeller)
$LTeller=$LTeller+1

; Process group name for server name
$ServerFromLocalGroup = SubStr($LGroup, 3, Len($LGroup) - 2)

; Get group object
$oGroup = GetObject("WinNT://@domain/$LGroup,group")

; Process group members for global groups
for each $member in $oGroup.members
if $member.class = "group"
; find only Global groups
if $member.grouptype & 2
;process group name for share
$GrpName = $member.name
$GetShareNameFromGlobalGroup = SubStr($GrpName, InStr($GrpName, "_") + 1)

; Map resource
; How are you going to apply the drive letter?
endif
endif
next
Until Len($LGroup) = 0

_________________________
Home page: http://www.kixhelp.com/hb/

Top
#38113 - 2003-03-25 04:25 PM Re: HOW CAN I REMOVE/PREVENT DOUBLE DRIVEMAPPINGS?
Kris Offline
Fresh Scripter

Registered: 2003-03-20
Posts: 13
Loc: Belgium
Howard,

They are global local groups that resign in a multi domain environment (trusted/trusting domains).

Top
#38114 - 2003-03-25 04:29 PM Re: HOW CAN I REMOVE/PREVENT DOUBLE DRIVEMAPPINGS?
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Does your last post have anything to do with the code I posted? Have you tried it? You will need to add lines to out the server and share names.

Please better describe your domain architecture. where is the client that runs the logon script and where do the group lives?

[ 25. March 2003, 16:30: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#38115 - 2003-03-25 04:43 PM Re: HOW CAN I REMOVE/PREVENT DOUBLE DRIVEMAPPINGS?
Kris Offline
Fresh Scripter

Registered: 2003-03-20
Posts: 13
Loc: Belgium
The previous post had nothing to do with your code but as an answer to your earlier question... There was something wrong with the bulletin board system cause my answers were not posted and than suddenly posted 3 times...
Top
#38116 - 2003-03-26 03:08 AM Re: HOW CAN I REMOVE/PREVENT DOUBLE DRIVEMAPPINGS?
bleonard Offline
Seasoned Scripter
*****

Registered: 2001-01-19
Posts: 581
Loc: Chicago, IL
Kris -
Perhaps this code can assist. Longer and more complex than my compatriates on the board as I have not mastered
UDFs, but works. It will load arrays with drive letters and drive shares in use on the workstation for all
LOCAL, PERSISTENT or NETWORK MAPPED drives.
It will compare each network mapping attempt against the arrays to determine if:
+ the drive letter is in use, mapped to another resource
+ the drive letter in use is already mapped to the desired resource
+ another drive is already mapped to that resource

Depending upon error conditions you desire, you can modify the code to skip some mappings, etc.

I have not attempted the printers, but perhaps the logic presented in this code can assist you as most of that info is stored in registry keys.

If of use to you and you've additional questions, email me as it's been some time since I've been on the board. And of course, if no use to you, simply ignore!

Bill

code:
; ########################################################
; ## FILE NAME: CHECKDRIVES.KIX ##
; ## LOCATION : \NETLOGON ##
; ## REVISION : 2003.01.01.1a ##
; ## KiX VER : 4.11 ##
; ## ##
; ## NOTES: Script to check local and persistent ##
; ## drives in use, and map network drives. ##
; ## AUTHOR : Bill Leonard ##
; ########################################################

; -------------------------------------------------------------------------

:CheckLocalDrives

; Determine local drive letters in use on WinXP/2K/9x systems
; -------------------------------------------------------------------------

; ** Declare variables as LOCAL (DIM, script-specific) or GLOBAL (KiX-session)
DIM $LocBreak, $Ok1, $Ok2, $RegKey, $TmpDrv, $TmpKey, $TmpVal, $TmpVal1, $TmpVal2, $TmpVal3
GLOBAL $DrvAll, $DrvEsdi, $DrvLocl, $DrvScsi, $DrvUnkn, $MapErrCnt
$DrvAll = ""
$DrvEsdi = ""
$DrvLocl = ""
$DrvScsi = ""
$DrvUnkn = ""


; ** If WinNT, skip to next section as info stored in registry as unreadable binary
; ** Can not determine local drives foe WinNT (binary in registry), block these letters from usage in other mappings
; ** The WinNT letters are suggested letters, not exact determinations, so some problems can be expected for some users
SELECT
CASE ($OS = "WinNT") $DrvLocl = "ABCDE" GOTO "ChkDrivesEnd"
CASE ($InWin = 1) GOTO "Win2KDrives"
CASE (1) GOTO "Win9XDrives"
ENDSELECT


:Win9XDrives
; ** Checks Win9x registry values
$x=0
DIM $RegKey1[3]
$RegKey1[$x] = "HKEY_LOCAL_MACHINE\Enum\ESDI" $x=$x+1
$RegKey1[$x] = "HKEY_LOCAL_MACHINE\Enum\FLOP" $x=$x+1
$RegKey1[$x] = "HKEY_LOCAL_MACHINE\Enum\SCSI" $x=$x+1
$x2=0
DO
IF KEYEXIST ($RegKey1[$x2]) = 1
$Ok1 = N
$x3 = 0
DO
$TmpVal1 = ENUMKEY ($RegKey1[$x2], $x3)
IF (@ERROR = 0)
IF (LEN ($TmpVal1) <> 0)
$Ok2 = N
$x4 = 0
$TmpKey = $RegKey1[$x2] + "\" + $TmpVal1
DO
$TmpVal2 = ENUMKEY($TmpKey, $x4)
IF (@ERROR = 0)
$TmpKey = $TmpKey + "\" + $TmpVal2
$TmpVal3 = READVALUE ($TmpKey, "Class")
$TmpDrv = READVALUE ($TmpKey, "CurrentDriveLetterAssignment")
IF (LEN ($TmpVal3) <> 0) AND (LEN ($TmpDrv) >= 1)
IF (INSTR ($DrvScsi, $TmpDrv) = 0) AND (INSTR ($DrvEsdi, $TmpDrv) = 0) ; ** Is drive letter already recorded?
SELECT
CASE (LCASE ($TmpVal3) = "cdrom") $DrvScsi = $DrvScsi + $TmpDrv
CASE (LCASE ($TmpVal3) = "diskdrive") $DrvEsdi = $DrvEsdi + $TmpDrv
CASE (1) $DrvUnkn = $DrvUnkn + $TmpDrv
ENDSELECT
ENDIF
ENDIF
ELSE $Ok2=Y
ENDIF
$x4=$x4+1
UNTIL ($Ok2 = Y)
ENDIF
ELSE $Ok1=Y
ENDIF
$x3=$x3+1
UNTIL ($Ok1 = Y)
ENDIF
$x2=$x2+1
UNTIL $x2=$x
GOTO "ChkDrivesEnd"

:Win2KDrives
; ** Checks WinXP/2K registry values. Note, WinXP/2K resgistry entries do not differentiate between ESDI/SCSI
; ** Data is stored in Binary, so no details of the device are obtainable (CD, SCSI, etc.)
$RegKey = "HKEY_LOCAL_MACHINE\SYSTEM\MOUNTEDDEVICES"
IF KEYEXIST ($RegKey) = 1
$LocBreak = "N"
$x=0
WHILE (@ERROR = 0) AND ($LocBreak = "N")
$TmpVal = ENUMVALUE ($RegKey, $x)
IF (@ERROR = 0) AND (LEN ($TmpVal <> 0))
IF INSTR ($TmpVal, "DosDevices")
$TmpDrv = UCASE (SUBSTR ($TmpVal, LEN ($TmpVal)-1,1))
IF (INSTR ($DrvLocl, $TmpDrv) = 0) ; ** Skip duplicate drive letter entries
$DrvLocl = $DrvLocl + $TmpDrv
ENDIF
ENDIF
ELSE
$LocBreak = "Y"
ENDIF
$x=$x+1
LOOP

IF (LEN ($DrvLocl) <> 0) AND INSTR ($DrvLocl, "0") $DrvLocl = SUBSTR ($DrvLocl, 1, LEN ($DrvLocl)-1)
ELSE $DrvLocl = SUBSTR ($DrvLocl, 1, LEN ($DrvLocl))
ENDIF
ENDIF

:ChkDrivesEnd
IF (LEN ($DrvEsdi) <> 0) $DrvEsdi = UCASE ($DrvEsdi) ENDIF
IF (LEN ($DrvScsi) <> 0) $DrvScsi = UCASE ($DrvScsi) ENDIF
IF (LEN ($DrvLocl) = 0) $DrvLocl = $DrvEsdi + $DrvScsi ENDIF
IF (LEN ($DrvUnkn) <> 0)
$Err = $Err+1
$DrvUnkn = UCASE ($DrvUnkn)
$wri = WRITELINE (1, "Check unknown drives recorded: $DrvUnkn" + $CR)
ENDIF

$DrvAll = $DrvLocl
GOSUB "AlphaDriveLetters"
IF ($OS = "WinNT") $Msg = "Skipped verify drive letters in use on WinNT system - blocking out $DrvAll"
ELSE $Msg = "Verified drive letters in use by local ESDI/SCSI devices: $DrvAll"
ENDIF
$wri = WRITELINE (1, "$Msg" + $CR)


; -------------------------------------------------------------------------

:CheckHomeDrive

; Determine if Home drive for user, set appropriate variables
; Perform before Persistent Drives in case users mapping their HomeDrv persistently
; -------------------------------------------------------------------------

; ** Declare variables as LOCAL (DIM, script-specific) or GLOBAL (KiX-session)
DIM $TmpShr
GLOBAL $DrvArrayIdx, $HomeChk, $HomeDrv, $HomeFullShr, $HomeShr, $HomeSvr
GLOBAL $DrvArrayLtr[30] ; ** Array to cross reference mapped drive letters
GLOBAL $DrvArrayShr[30] ; ** Array to cross reference mapped drive shares
$DrvArrayIdx = 0
$HomeChk = N ; ** Bucket tracking successful home drive connection

; ** Set HOME drive variables - drive letter, server name, root share. Undefined HOME dir recorded in logs under drive mapping routine
$RC = @HOMESHR
IF ($RC = "") $HomeDrv = "Undefined"
ELSE
$RC2 = @HOMEDRIVE
IF ($RC2 = "") $HomeDrv = "H:"
ELSE $HomeDrv = @HOMEDRIVE
ENDIF
$TmpShr = SUBSTR (@HOMESHR, 3, LEN (@HOMESHR)) ; ** Parse value '\\server\share' for 'server\share', remove leading '\\' so further parsing for '\' will work
SELECT
CASE (INSTR ($TmpShr, LCASE ("\Home")) <> 0) ; ** Profile Home DIR formatted: \\Server\Home\UserName / \\Server\Home\UserName$
$HomeShr = @LONGHOMEDIR ; ** Set variable to KiX Macro value
IF (SUBSTR (@LONGHOMEDIR, LEN (@LONGHOMEDIR), 1) <> "$") ; ** Check if '$' character at end of value indicating hidden share defined
$HomeShr = @LONGHOMEDIR + "$" ; ** Set variable to KiX Macro value, add '$' as share should be hidden
ENDIF
$XtraDir = SUBSTR ($TmpShr, INSTR ($TmpShr, "\")+1, LEN ($TmpShr)) ; ** Parse value, removing value of extra DIR 'users' to get to Server name
$HomeSvr = UCASE (SUBSTR (@HOMESHR, 1, LEN (@HOMESHR)-LEN ($XtraDir)-1)) ; ** Parse server name from user profile string
CASE (1) ; ** Profile Home DIR formatted: \\Server\UserName / \\Server\UserName$
$HomeShr = SUBSTR ($TmpShr, INSTR ($TmpShr, "\")+1, LEN ($TmpShr))
IF (SUBSTR ($HomeShr, LEN ($HomeShr), 1) <> "$")
$HomeShr = $HomeShr + "$"
ENDIF
$HomeSvr = UCASE (SUBSTR (@HOMESHR, 1, LEN (@HOMESHR)-LEN ($HomeShr)-1))
ENDSELECT
$HomeFullShr = $HomeSvr + "\" + $HomeShr
ENDIF


; -------------------------------------------------------------------------

:CheckPersistentDrives

; Determine persistent drive letters in use on all systems.
; Can also delete persistent drives - uncomment ';;;' lines.
; DECREMENTING index is most efficient to ensure all removed.
; -------------------------------------------------------------------------

; ** Declare variables as LOCAL (DIM, script-specific) or GLOBAL (KiX-session)
; NOTE: $PersDrv = tmp value of persistent drives in registry $DrvPers = list of all found persistent drives
DIM $PersChk, $PersDrv, $PersErr, $PersKey, $PersShr, $TmpAll, $TmpDelPersDrv, $TmpHomeShr
GLOBAL $DrvPers
$DrvPers = ""
$TmpDelPersDrv = N

IF ($InWin = 1) $PersKey = "HKEY_CURRENT_USER\Network"
ELSE $PersKey = "HKEY_CURRENT_USER\Network\Persistent"
ENDIF

; ** Get count of total existing entries under this key
$x=-1
DO
$x=$x+1
$RC = ENUMKEY ($PersKey, $x)
IF ($RC + ":" = $HomeDrv) ; ** Is the home drive letter in list of persistent drives?
$HomeChk = P
ENDIF
UNTIL @ERROR <> 0

; ** After checking persistent drive entries for home drive letter, verify access to home drive now
IF EXIST ("$HomeDrv\*.*") <> 0 AND ($HomeChk <> P)
$DrvArrayLtr[$DrvArrayIdx] = $HomeDrv ; ** Populate array of known mapped resources
$DrvArrayShr[$DrvArrayIdx] = $HomeFullShr
$DrvArrayIdx = $DrvArrayIdx+1
$HomeChk = Y
$wri = WRITELINE (1, "Verified access to users home drive $HomeDrv $HomeSvr\$HomeShr" + $CR)
ENDIF

; ** Only continue if persistent drives are found
IF ($x=0)
$Status = $OK
$wri = WRITELINE (1, "Verified no persistent drives defined" + $CR)
GOTO "MapNetworkDrives"
ENDIF

$x2=($x-1) ; ** Last value for 'x' will be error (one greater than necessary)
DO
$PersDrv = UCASE (ENUMKEY ($PersKey, $x2))
$PersShr = UCASE (READVALUE ("$PersKey\$PersDrv", "RemotePath"))
SELECT
CASE LEN ($PersShr) < 5 ; ** 5 characters minimum length for a valid persistent resource (i.e \\X\Y)
$Msg = "Error - invalid persistent drive value in registry ($PersKey\$PersDrv, data: $PersShr)"
$TmpDelPersDrv = Y
CASE ($PersDrv + ":" = $HomeDrv) AND ($PersShr = $HomeSvr + "\" + $HomeShr)
$Msg = "Error - persistent drive $PersDrv: $PersShr matches users Home drive and share - persistent drive will be removed from registry"
$TmpDelPersDrv = Y
CASE ($PersDrv + ":" = $HomeDrv)
$Msg = "Error - persistent drive $PersDrv: $PersShr matches users Home drive but not Home share - persistent drive will be removed from removed from registry"
$TmpDelPersDrv = Y
CASE (1)
; ** Confirm can actually access the persistent shared resource
$PersChk = EXIST ("$PersDrv:\*.*")
SELECT
CASE (@ERROR = 0) AND ($PersChk <> 0) $Msg = "Verified access to persistent drive $PersDrv: $PersShr"
CASE (@ERROR = 3) AND ($OS = "Win9X") $Msg = "Verified persistent drive $PersDrv: $PersShr (Not accessible at logon script processing for $OSAbv)"
CASE (@ERROR = 0) $Msg = "Error - verify access to persistent drive $PersDrv: $PersShr (check: $PersChk)"
CASE (INSTR ($PersShr, "\\SOURCECONTROL") <> 0)
$Msg = "Error @ERROR attempting to verifying access to persistent drive $PersDrv: $PersShr (@SERROR)"
CASE ($PersChk <> 0) $Err = $Err+1 $Msg = "Error @ERROR after verifying access to persistent drive $PersDrv: $PersShr (@SERROR / check: $PersChk)"
CASE (1) $Err = $Err+1 $Msg = "Error @ERROR attempting to verifying access to persistent drive $PersDrv: $PersShr (@SERROR)"
ENDSELECT

; ** Populate array of known mapped resources for cross referencing
$DrvArrayLtr[$DrvArrayIdx] = $PersDrv
$DrvArrayShr[$DrvArrayIdx] = $PersShr
$DrvArrayIdx = $DrvArrayIdx+1
ENDSELECT
$wri = WRITELINE (1, "$Msg" + $CR)

; ** Only delete persistent drives based upon flag set in seperate INI file, or if persistent also the home drive
SELECT
CASE ($DelPersDrv = Y) OR ($TmpDelPersDrv = Y)
$con = DELKEY ("$PersKey\$PersDrv")
IF (@ERROR = 0)
$Msg = "Successfully removed persistent drive $PersDrv:"
ELSE
$DrvPers = $DrvPers + $PersDrv
$Err = $Err+1
$Msg = "Error @ERROR removing persistent drive $PersDrv: (@SERROR)"
ENDIF
$wri = WRITELINE (1, "$Msg" + $CR)
CASE ($PersChk <> "") $DrvPers = $DrvPers + $PersDrv ; ** Persistent drive was accessable
CASE ($OS = "Win9X") $DrvPers = $DrvPers + $PersDrv ; ** Persistent drives can not be checked for Win9X, so assume accessible
CASE (1)
;; $DrvPers = $DrvPers + $PersDrv
;; $wri = WRITELINE (1, "Error - can not verify access to persistent drive (PersChk: $PersChk / Del: $DelPersDrv / TmpDel: $TmpDelPersDrv)" + $CR)
ENDSELECT

$TmpDelPersDrv = N
$x2=$x2-1
UNTIL $x2 < 0
$DrvAll = $DrvAll + $DrvPers


; -------------------------------------------------------------------------

:MapNetworkDrives

; Map network data drives to resources defined in 'mapdrives.kix' file
; -------------------------------------------------------------------------

; ** Declare variables as LOCAL (DIM, script-specific) or GLOBAL (KiX-session)
DIM $Disp, $LtrErr, $MapChk, $MapErr, $TmpDrv, $TmpShr
GLOBAL $DrvLtrFound, $DrvMapFound, $MapDrv, $MapShr

$ErrorMsg = "Error mapping network drives on your workstation. A system administrator has been notified."
$DelErr = N ; ** Bucket track errors attempting to delete existing mapped network drive
$LtrErr = N ; ** Bucket to track errors due to drive-letter conflicts
$MapChk = "" ; ** Bucket to confirm mapping worked
$MapDrv = "" ; ** Hold array value for drive letter to map from 'mapdrives_<domain>.kix'
$MapErr = "" ; ** Bucket to note error mapping each drive
$MapSer = "" ; ** Bucket to note error mapping each drive SERROR message
$MapShr = "" ; ** Hold array value for drive share to map to from 'mapdrives_<domain>.kix'
$TmpMap = ""

CALL "$CallKix\mapdrives_" + "$LDom.kix" ; ** Load array with domain/office-specific drive mapping values
IF ($DrvIdx=0)
$wri = WRITELINE (1, "Verified no network drives to map" + $CR)
$Status = $OK
RETURN
ENDIF

$DrvIdxChk=0 ; ** Counter to compare with map drive index count from 'mapdrives_<domain>.kix'
DO
IF $Group[$DrvIdxChk]
$MapDrv = $Drive[$DrvIdxChk]
$MapShr = $Share[$DrvIdxChk]

; ** Confirm drive letter chosen available for mapping (uses results of sections 'CheckLocalDrives' and 'CheckPersistentDrives' above)
$TmpDrv = SUBSTR ($MapDrv, 1, 1) ; ** Change 'H:' to 'H'
SELECT
CASE ($MapDrv = $HomeDrv) AND ($HomeDrv = "Undefined") ; ** Home drive not configured for user in Windows Domain
$MapChk = N
$MapErr = 0
$MapDrv = "" ; ** Null value for logging
$MapShr = "" ; ** Null value for logging
$Msg = "Home directory undefined for user $UserID:"
GOTO "WriteMapLog"
CASE ($MapDrv = "") OR ($MapShr = "") ; ** Blank values for MapDrv or MapShr variables - abort mapping routine
$MapChk = N
$MapErr = 0
$Msg = "blank values for drive or share:"
GOTO "WriteMapLog"
CASE ($MapDrv = $HomeDrv) AND ($HomeChk = Y) ; ** Home drive access already exists, access checked and logged - no script mapping necessary
$DrvAll = $DrvAll + $TmpDrv
GOTO "WriteMapLog" ; ** Go here to write screen display for end-user; no logging performed
CASE INSTR ($DrvLocl, $TmpDrv) <> 0 ; ** Drive letter to map found in list of local ESDI/SCSI devices - abort mapping this resource
;; $Err = $Err+1 ; ** Should error alerts be generated?
$LtrErr = Y
$Msg = "Error - drive letter $MapDrv in use on system as local drive. Remapping to $MapShr will be aborted"
GOTO "WriteMapLog"
CASE (1)
GOSUB "CheckMappedDrives"
SELECT
CASE ($DrvMapFound = DP) ; ** Persistent drive already mapped to this share - delete persistent drive, continue mapping
$wri = WRITELINE (1, "$Msg" + $CR)
CASE ($DrvMapFound = NM) ; ** Network drive and share already mapped via logon script - abort mapping
$LtrErr = Y
GOTO "WriteMapLog"
CASE ($DrvMapFound = PM) ; ** Persistent drive already mapped to another share - abort mapping
$Err = $Err+1
$LtrErr = Y
GOTO "WriteMapLog"
CASE ($DrvMapFound = LM) ; ** Network drive mapped to another share - delete current mapping, continue new mapping
ENDSELECT
ENDSELECT

; ** Delete current connection if exists, map drive, then confirm user can actually access the newly mapped drive
; ** Only update list of in-use drives (DrvAll) if can properly access network drive
IF (EXIST ("$MapDrv\*.*") = 1)
USE $MapDrv /DELETE /PERSISTENT
IF (@ERROR <> 0)
$DelErr = Y
$Msg = "Error @ERROR deleting existing mapped drive $MapDrv. Remapping to $MapShr will be aborted (@SERROR)"
GOTO "WriteMapLog"
ENDIF
ENDIF

USE $MapDrv $MapShr
$MapErr = @ERROR
$MapSer = @SERROR
SELECT
CASE ($MapErr = 0) AND (INSTR ($Share[$DrvIdxChk], "_Zip") <> 0) ; ** Mappings to Zip drives will not always find disk in the drive. Assume proper mapping
$DrvAll = $DrvAll + $TmpDrv
$MapChk = Y
CASE ($MapErr = 0) ; ** Successfull mapping, confirm access to resource
$MapChk = EXIST ("$MapDrv\*.*")
IF (@ERROR = 0)
IF ($MapDrv = $HomeDrv)
$HomeMap = Y
$wri = WRITELINE (1, "Verified access to mapped home drive $MapDrv $MapShr" + $CR)
ENDIF
$DrvAll = $DrvAll + $TmpDrv
$MapChk = Y
ENDIF
CASE ($MapErr = 85) AND ($OS = "WinNT") ; ** Attempted mapping using Local device (WinNT can not enumerate)
$DrvAll = $DrvAll + $TmpDrv
$LtrErr = Y
$wri = WRITELINE (1, "Error $MapErr mapping drive $MapDrv to $MapShr ($MapSer)" + $CR)
CASE (1) ; ** All other errors pass through to next select statement
ENDSELECT

; ** Populate array of known mapped resources for cross referencing
$DrvArrayLtr[$DrvArrayIdx] = $MapDrv
$DrvArrayShr[$DrvArrayIdx] = $MapShr
$DrvArrayIdx = $DrvArrayIdx+1

:WriteMapLog
; ** Display results on console for users benefit
$Row = $Row + 1
? " " + $MapDrv + " $MapShr"
SELECT
CASE ($HomeChk = Y) OR ($HomeMap = Y) AT ($Row,70) " OK" ; ** Verified users home drive access (modified Msg for logging)
CASE ($MapErr = 0) AT ($Row,70) " OK" ; ** No mapping problems
$Msg = "mapped drive"
CASE ($DrvMapFound = Y) AT ($Row,70) " OK" ; ** Resource already mapped, identical mapping routine skipped
CASE ($MapChk = N) AND ($MapErr = 1) ; ** Invalid MapDrv and/or MapShr values
CASE ($DelErr = Y) AT ($Row,70) "Error" ; ** Error deleting existing mapped drive
CASE ($LtrErr = Y) AT ($Row,70) "Skipped" ; ** Drive mapping letter in use as local/persistent drive
CASE (1) AT ($Row,70) "Error" ; ** All other mapping errors
$Err = $Err+1
$LtrErr = Y
$Msg = "Error $MapErr mapping drive $MapDrv to $MapShr ($MapSer / Drv: $MapDrv / Shr: $MapShr)"
ENDSELECT

; ** Write log file after confirming drive mapping success/failure by end-user ability to access the mapped drive.
SELECT
CASE ($DelErr = Y) OR ($LtrErr = Y)
CASE ($HomeChk = Y) OR ($HomeMap = Y) GOTO "ResetMappingVars" ; ** No Msg value to write
CASE ($MapErr = 0) AND ($MapChk = Y) $Msg = "Verified access to $Msg $MapDrv $MapShr"
CASE ($MapErr = 0) $Msg = "Unconfirmed: $Msg $MapDrv $MapShr"
CASE (1)
IF ($MapSer = "") $Msg = "Error $Msg $MapDrv $MapShr (@SERROR)"
ELSE $Msg = "Error $Msg $MapDrv $MapShr ($MapSer)"
ENDIF
ENDSELECT
$wri = WRITELINE (1, "$Msg" + $CR)

:ResetMappingVars
; ** Reset in-use variables for next loop routine
$DelErr = N
$HomeChk = ""
$HomeMap = ""
$LtrErr = N
$MapChk = ""
$MapErr = ""
$MapSer = ""
ENDIF

$DrvIdxChk=$DrvIdxChk+1
UNTIL $DrvIdxChk=$DrvIdx

GOSUB "AlphaDriveLetters"

; ** Not necessary to always print this info (2002.02.07 Bill L)
IF ($OS <> "WinNT") $Msg = "Verified all drive letters in use: $DrvAll"
ELSE $Msg = "Windows NT drive letters in use: $DrvAll"
ENDIF
$wri = WRITELINE (1, "$Msg" + $CR)
$Row = $Row + 1
RETURN



; //////////////////////////////////////////////////////////////////////////////////////////////
;
; REUSED COMPONENTS CALLED FROM ABOVE
;
; //////////////////////////////////////////////////////////////////////////////////////////////


; -------------------------------------------------------------------------

:CheckMappedDrives

; Check array of mapped resources to see if this resource already in use
; -------------------------------------------------------------------------

; ** Declare variables as LOCAL (DIM, script-specific) or GLOBAL (KiX-session)
DIM $DrvArrayIdxChk
GLOBAL $TmpArrayLtr, $TmpArrayShr

$DrvMapFound = N
$DrvArrayIdxChk = 0
DO
$TmpArrayLtr = $DrvArrayLtr[$DrvArrayIdxChk]
$TmpArrayShr = $DrvArrayShr[$DrvArrayIdxChk]
IF INSTR ("$TmpArrayLtr", ":") = 0 ; ** Confirm drive letter variable has colon
$TmpArrayLtr = $TmpArrayLtr + ":"
ENDIF

SELECT
CASE ($MapDrv = $TmpArrayLtr) AND ($MapShr = $TmpArrayShr) AND INSTR ($DrvPers, $TmpDrv) <> 0 ; ** Drive/Share mapping exists as as persistent drive
$DrvArrayIdxChk = $DrvArrayIdx
$DrvMapFound = DP
$Msg = "Verified drive $TmpArrayLtr $TmpArrayShr already mapped as a persistent drive. Persistent mapping will be removed, remapping to $MapDrv $MapShr will continue."
CASE ($MapDrv = $TmpArrayLtr) AND ($MapShr = $TmpArrayShr) ; ** Drive/Share mapping exists, not persistent
$DrvArrayIdxChk = $DrvArrayIdx
$DrvMapFound = NM
$Msg = "Verified network drive exists - $TmpArrayLtr $TmpArrayShr - remapping will be aborted."
CASE ($MapDrv = $TmpArrayLtr) AND INSTR ($DrvPers, $TmpDrv) <> 0 ; ** Drive mapped as persistent, share different
$DrvArrayIdxChk = $DrvArrayIdx
$DrvMapFound = PM
$Msg = "Error - verified $TmpArrayLtr $TmpArrayShr is a persistent drive. Remapping to $MapDrv $MapShr will be aborted"
CASE ($MapDrv = $TmpArrayLtr) ; ** Drive mapped, not persistent, share different
$DrvArrayIdxChk = $DrvArrayIdx
$DrvMapFound = LM
$wri = WRITELINE (1, "Error - verified $TmpArrayLtr $TmpArrayShr already a mapped drive. Remapping to $MapDrv $MapShr will continue" + $CR)
CASE ($MapShr = $TmpArrayShr) AND INSTR ($DrvPers, SUBSTR ($TmpArrayLtr, 1, 1)) <> 0 ; ** Share mapped with different persistent drive
$wri = WRITELINE (1, "Verified $MapDrv $MapShr resource already mapped with persistent drive $TmpArrayLtr $TmpArrayShr" + $CR)
CASE ($MapShr = $TmpArrayShr) ; ** Share mapped with different drive, not persistent
$wri = WRITELINE (1, "Verified $MapDrv $MapShr resource already mapped as $TmpArrayLtr $TmpArrayShr" + $CR)
ENDSELECT
$DrvArrayIdxChk = $DrvArrayIdxChk+1
UNTIL ($DrvArrayIdxChk >= $DrvArrayIdx)
RETURN


; -------------------------------------------------------------------------

:AlphaDriveLetters

; Arrange a list of drive letters alphabetically to ease log viewing
; -------------------------------------------------------------------------

; ** Declare variables as LOCAL (DIM, script-specific) or GLOBAL (KiX-session)
DIM $ChkLen2, $Idx1, $Idx2, $TmpAll1, $TmpAll2, $TmpDrv1, $TmpDrv2, $TmpLen1, $TmpLen2

IF LEN ($DrvAll) = 1 RETURN ENDIF
$TmpAll1 = ""
$TmpLen1 = LEN ($DrvAll)
$Idx1=0
DO
$Idx1=$Idx1+1
$TmpDrv1 = SUBSTR ($DrvAll, $Idx1, 1)
IF ($Idx1 = 1) $TmpAll1 = $TmpDrv1
ELSE
$Idx2=0
$TmpAll2 = ""
DO
$Idx2=$Idx2+1
$TmpLen2 = LEN ($TmpAll1)
$TmpDrv2 = SUBSTR ($TmpAll1, $Idx2, 1)
SELECT
CASE ($TmpDrv2 >= 0) AND ($TmpDrv2 <= 9) ; ** Do not include non-alpha values
CASE ($TmpDrv1 < $TmpDrv2) AND ($Idx2 = 1) $TmpAll2 = $TmpDrv1 + $TmpAll1
$Idx2 = $TmpLen2
CASE ($TmpDrv1 < $TmpDrv2) AND ($Idx2 <= $TmpLen2) $TmpAll2 = $TmpAll2 + $TmpDrv1 + SUBSTR ($TmpAll1, $Idx2, LEN ($TmpAll1))
$Idx2 = $TmpLen2
CASE ($TmpDrv1 > $TmpDrv2) AND ($Idx2 < $TmpLen2) $TmpAll2 = $TmpAll2 + $TmpDrv2
CASE ($TmpDrv1 > $TmpDrv2) AND ($Idx2 = $TmpLen2) $TmpAll2 = $TmpAll2 + $TmpDrv2 + $TmpDrv1
CASE ($TmpDrv1 = $TmpDrv2) AND INSTR ($TmpAll2, $TmpDrv1) <> 0 ; ** Explicitly catch duplicate letters from being listed here
CASE (1)
ENDSELECT
UNTIL ($Idx2 = $TmpLen2) OR ($TmpLen2 = 0)
$TmpAll1 = $TmpAll2
ENDIF
UNTIL ($Idx1 = $TmpLen1) OR ($TmpLen1 = 0)
$DrvAll = $TmpAll1
RETURN


Top
#38117 - 2003-03-26 06:22 AM Re: HOW CAN I REMOVE/PREVENT DOUBLE DRIVEMAPPINGS?
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Not to THREAD Hijaak, but Welcome back Bill [Big Grin]

Okay, back to the regularly scheduled topic.

Kris,

Please try Howard and Bills code and then report back your results.

Top
#38118 - 2003-03-26 09:57 AM Re: HOW CAN I REMOVE/PREVENT DOUBLE DRIVEMAPPINGS?
Kris Offline
Fresh Scripter

Registered: 2003-03-20
Posts: 13
Loc: Belgium
I will try the code this afternnon (CET) and get back to you guys ASAP. Thanx for the efforts so far !!!! [Wink]
Top
#38119 - 2003-03-26 07:40 PM Re: HOW CAN I REMOVE/PREVENT DOUBLE DRIVEMAPPINGS?
bleonard Offline
Seasoned Scripter
*****

Registered: 2001-01-19
Posts: 581
Loc: Chicago, IL
NTDOC - you roped me back in. I though I could kick the habit, but no such luck... I can only guess the quality of postings here need to be punched up a bit... or the need for some humor at my expense! [Wink] Bill
Top
#38120 - 2003-03-27 03:40 PM Re: HOW CAN I REMOVE/PREVENT DOUBLE DRIVEMAPPINGS?
Kris Offline
Fresh Scripter

Registered: 2003-03-20
Posts: 13
Loc: Belgium
Guys,

We map printerconnections and 3 networkdrives with this script. The mapping of the networkdrives and the printers is done in the same way: We check the user's local groups "LOCAL groups are always SERVERNAMES in our naming convention" and the global groups "GLOBAL groups are always PRINTERNAMES or SHARENAMES in our naming convention" in these local groups. Now we get the servernames out of the local groups and the printer- and sharenames out of the globalgroups that reside in these local groups.

EG: User LEONARDB logs on and is a member of these local and global groups:

Global Groups for shares and printers = "GG"
Local groups for servernames = "LG"

"GG"Printer10----------->"LG"Server1
"GG"Printer20----------->"LG"Server2
"GG"Workgroup----------->"LG"Server3
"GG"Project------------->"LG"Server4
"GG"Application--------->"LG"Server5


The script will try to match all the servernames from local groups with all the share- and/or printernames from the global groups. In this case the result when the script ends will be:



Added printerconnections:
\\Server1\Printer10
\\Server2\Printer20

Mapped networkdrives:
G:\\Server3\Workgroup
Q:\\Server4\Projects
S:\\Server5\Application

THE ONE REMAINING PROBLEM NOW IS that sometimes the workgroup mapping is for example mapped to the application mapping so the 3 mappings sometimes partially or all switch places "because users are in a lot more groups" and we want to script that possibility away.

PS: I COULD NOT UPLOAD THE FULL SCRIPT BECAUSE THE BUTTETIN BOARD SAID "Sorry, we do not permit this HTML tag: Parenthesis in HTML tag"

Top
#38121 - 2003-03-27 04:08 PM Re: HOW CAN I REMOVE/PREVENT DOUBLE DRIVEMAPPINGS?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Please read the FAQ Forum under HOWTO: Submit code to / copy code from the board
_________________________
There are two types of vessels, submarines and targets.

Top
#38122 - 2003-03-27 04:21 PM Re: HOW CAN I REMOVE/PREVENT DOUBLE DRIVEMAPPINGS?
Kris Offline
Fresh Scripter

Registered: 2003-03-20
Posts: 13
Loc: Belgium
Thanx Jens!!!
Here's the final code if you study this you will meen waht I mean with the problem described in my previous post...

code:
; Script voor basislogon van eindgebruikers
; Auteur: Ingo Van den Broeck
; Versie: 26/11/2001
; Aanpassing 26/11/2001: Ingo Van den Broeck - Opbouw scriptlogica
break on

; Apply basic data
$TimeStamp = substr(@date,1,4) + "-" + substr(@date,6,2) + "-" + substr(@date,9,2) + " om " + substr(@time,1,2) + substr(@time,4,2) + substr(@time,7,2)

; Number of different resource servers
dim $aServers[5] ; applicatieservers
dim $dServers[5] ; printservers
dim $pServers[5] ; projectservers
dim $wServers[10] ; werkgroepservers

$aServerTel = 0
$dServerTel = 0
$pServerTel = 0
$wServerTel = 0

; Number of different groups
dim $aGroepen[50] ; applicatiegroepen
dim $dGroepen[50] ; printergroepen
dim $pGroepen[50] ; projectgroepen
dim $wGroepen[50] ; werkgroepen

$aGroepTel = 0
$dGroepTel = 0
$pGroepTel = 0
$wGroepTel = 0

; Timesynchronisationserver
$TimeServer = @lserver

; Standard reserved driveletters
$WerkLetter = "GJKL-"
$ApplLetter = "QRP-"
$ProjLetter = "STUV-"


; Process and remember the pure primary group (without security-rights)
$PrimGroep = ucase(@primarygroup)
select
case substr($PrimGroep, 1, 5) = "APPL_" ; dit is zeker geen standaard werkgroep
$PrimGroep = "onbekend"
case substr($PrimGroep, 1, 5) = "PROJ_" ; dit is zeker geen standaard werkgroep
$PrimGroep = "onbekend"
case substr($PrimGroep, 1, 5) = "PRNT_" ; dit is zeker geen standaard werkgroep
$PrimGroep = "onbekend"
case 1
if substr($PrimGroep, len($PrimGroep) - 1, 1) = "-"
$PrimGroep = substr($PrimGroep, 1, len($PrimGroep) - 2)
endif
endselect

; Empty screen an show scriptlayout
color w/b
box(0, 0, 3, 79, single)
at(1, 6) "Welkom op het netwerk van het ministerie van de Vlaamse Gemeenschap"
at(2, 34 - (len(@primarygroup) / 2)) "Entiteit " + $PrimGroep

; Show user details
color w/n
box(4, 0, 24, 79, single)
at(6, 3) "Naam : "
at(7, 3) "Loginnaam : "
at(8, 3) "Commentaar: "
at(10, 3) "Homedir : "
at(11, 3) "Computer : "
at(12, 3) "IP-adres : "
at(13, 3) "MAC-adres : "
color n/w
at(4, 1) " Identificatie "
at(4, 67) " " + @mdayno + "/" + @monthno + "/" + @year + " "
color g+/n
at(6, 15) @fullname + " (" + @priv + ")"
at(7, 15) @ldomain + "\" + @userid
at(8, 15) @comment
if len(@homedrive) = 0
at(10, 15) "-"
else
at(10, 15) @homedrive + "\" + @longhomedir
endif
at(11, 15) @domain + "\" + @wksta
at(12, 15) ltrim(@ipaddress0)
at(13, 15) @address
color w+/n+
box(10, 40, 24, 65, single)
box(10, 66, 24, 79, single)
color n+/w+
at(10, 41) " Netwerkkoppelingen "
at(10, 67) " Printers "
color n/r+
at(18, 3) " Even geduld aub... "
color w+/n+


; Start a prologue-script if one present
if exist (@lserver + "\netlogon\gscripts\Proloog.kix")
call @lserver + "\netlogon\gscripts\Proloog.kix"
endif


; Make the standaard reserved driveletters free
$ScriptDrives = $WerkLetter ; + $ApplLetter + $ProjLetter
$teller = 1
do
use substr($ScriptDrives, $teller, 1) + ":" /delete /persistent
$teller = $teller + 1
until $teller > len($ScriptDrives)


; Mount Homedrive
if len(@homedrive) = 0
$DriveLijn = 12
else
at(12, 42) @homedrive + " Homedrive"
$DriveLijn = 13
endif


; Make grouplist of the local groups (= list of servers)
$teller = 0
do
$groep = enumlocalgroup($teller)
$teller = $teller + 1
select
case ucase(substr($groep, 1, 2)) = "A-" ; Applicatieserver
$aServerTel = $aServerTel + 1
$aServers[$aServerTel] = "\\" + substr($groep, 3, len($groep) - 2)
case ucase(substr($groep, 1, 2)) = "D-" ; Printserver
$dServerTel = $dServerTel + 1
$dServers[$dServerTel] = "\\" + substr($groep, 3, len($groep) - 2)
case ucase(substr($groep, 1, 2)) = "P-" ; Projectserver
$pServerTel = $pServerTel + 1
$pServers[$pServerTel] = "\\" + substr($groep, 3, len($groep) - 2)
case ucase(substr($groep, 1, 2)) = "W-" ; Werkgroepserver
$wServerTel = $wServerTel + 1
$wServers[$wServerTel] = "\\" + substr($groep, 3, len($groep) - 2)
endselect
until len($groep) = 0


; Make grouplist of the global groups (list of applications, printers, projectd and workgroups)
$teller = 0
do
$groep = enumgroup($teller)
if substr($groep, len($groep) - 1, 1) = "-"
$groep = substr($groep, 1, len($groep) - 2)
endif
$teller = $teller + 1
select
case substr($groep, 1, 5) = "APPL_" ; Applicationgroups
$gtel = 0
while $gtel <= $aGroepTel
$gtel = $gtel + 1
if $gtel > $aGroepTel
$aGroepTel = $aGroepTel + 1
$aGroepen[$aGroepTel] = $groep
endif
if instr($groep, $aGroepen[$gtel]) or instr($aGroepen[$gtel], $groep)
$gtel = $aGroepTel + 1
endif
loop
case substr($groep, 1, 5) = "PROJ_" ; Projectgroups
$gtel = 0
while $gtel <= $pGroepTel
$gtel = $gtel + 1
if $gtel > $pGroepTel
$pGroepTel = $pGroepTel + 1
$pGroepen[$pGroepTel] = $groep
endif
if instr($groep, $pGroepen[$gtel]) or instr($pGroepen[$gtel], $groep)
$gtel = $pGroepTel + 1
endif
loop
case substr($groep, 1, 5) = "PRNT_" ; Printgroups
$gtel = 0
while $gtel <= $dGroepTel
$gtel = $gtel + 1
if $gtel > $dGroepTel
$dGroepTel = $dGroepTel + 1
$dGroepen[$dGroepTel] = substr($groep, 6, len($groep) - 5)
endif
if instr($groep, $dGroepen[$gtel]) or instr($dGroepen[$gtel], $groep)
$gtel = $dGroepTel + 1
endif
loop
case 1 ; Werkgroepen
; remove maximal the first two underscores,
; these workgroups are only of use if a share exists for it,
; so just for dep_adm or dep_adm_afd or no shares at all (in special cases)
$tempg = substr($groep, instr($groep, "_") + 1, len($groep) - instr($groep, "_"))
$tempg = substr($tempg, instr($tempg, "_") + 1, len($tempg) - instr($tempg, "_"))
if instr($tempg, "_") = 0
$gtel = 0
while $gtel <= $wGroepTel
$gtel = $gtel + 1
if $gtel > $wGroepTel
$wGroepTel = $wGroepTel + 1
$wGroepen[$wGroepTel] = $groep
endif
if instr($groep, $PrimGroep) or instr($PrimGroep, $groep) or instr($groep, $wGroepen[$gtel]) or instr($wGroepen[$gtel], $groep)
$gtel = $wGroepTel + 1
endif
loop
endif
endselect
until len($groep) = 0


; Get all Local and Global Groups
$arLocal = GetUserLocalGroups()
$arGlobal = GetUserGlobalGroups()


; mount the workgroups
; Take standard workgroep first (primary group)
if $wServerTel > 0
if $PrimGroep <> "onbekend"
use substr($WerkLetter, 1, 1) + ":" $wServers[1] + "\" + $PrimGroep
if @error = 0
at($DriveLijn, 42) substr($WerkLetter, 1, 1) + ": " + $PrimGroep
$DriveLijn = $DriveLijn + 1
$letter = 2
else
$letter = 1
endif
endif
$teller = 0
while $teller < $wGroepTel
$teller = $teller + 1
$stel = 0
while $stel < $wServerTel and substr($WerkLetter, $letter, 1) <> "-"
; Maak koppeling voor werkgroep(en)
$stel = $stel + 1
use substr($WerkLetter, $letter, 1) + ":" $wServers[$stel] + "\" + $wGroepen[$teller]
if @error = 0
at($DriveLijn, 42) substr($WerkLetter, $letter, 1) + ": " + $wGroepen[$teller]
if $DriveLijn < 22
$DriveLijn = $DriveLijn + 1
endif
$letter = $letter + 1
$stel = $wServerTel
if exist (@lserver + "\netlogon\gscripts\" + $wGroepen[$teller] + ".kix")
call @lserver + "\netlogon\gscripts\" + $wGroepen[$teller] + ".kix"
endif
endif
loop
loop
endif

; mount the applications
if $aServerTel > 0
$teller = 0
$letter = 1
while $teller < $aServerTel and substr($ApplLetter, $letter, 1) <> "-"
$teller = $teller + 1
use substr($ApplLetter, $letter, 1) + ":" /delete /persistent
use substr($ApplLetter, $letter, 1) + ":" $aServers[$teller] + "\APPL" + substr($aServers[$teller],len($aServers[$teller])-2,3)
if @error = 0
at($DriveLijn, 42) substr($ApplLetter, $letter, 1) + ": Applicatie(s)"
if $DriveLijn < 22
$DriveLijn = $DriveLijn + 1
endif
$letter = $letter + 1
endif
loop
endif


; execute eventual specific scripts bound to applications
$teller = 0
while $teller < $aGroepTel
$teller = $teller + 1
if exist (@lserver + "\netlogon\gscripts\" + $aGroepen[$teller] + ".kix")
call @lserver + "\netlogon\gscripts\" + $aGroepen[$teller] + ".kix"
endif
loop


; mount the projects
if $pServerTel > 0
$teller = 0
$letter = 1
while $teller < $pServerTel and substr($ProjLetter, $letter, 1) <> "-"
$teller = $teller + 1
use substr($ProjLetter, $letter, 1) + ":" /delete /persistent
use substr($ProjLetter, $letter, 1) + ":" $pServers[$teller] + "\PROJ" + substr($pServers[$teller],len($pServers[$teller])-2,3)
if @error = 0
at($DriveLijn, 42) substr($ProjLetter, $letter, 1) + ": Project(en)"
if $DriveLijn < 22
$DriveLijn = $DriveLijn + 1
endif
$letter = $letter + 1
endif
loop
endif


; execute eventual scripts that are bound to projects
$teller = 0
while $teller < $pGroepTel
$teller = $teller + 1
if exist (@lserver + "\netlogon\gscripts\" + $pGroepen[$teller] + ".kix")
call @lserver + "\netlogon\gscripts\" + $pGroepen[$teller] + ".kix"
endif
loop


; mount printers
$DriveLijn = 12
if $dServerTel > 0
$teller = 0
while $teller < $dGroepTel
$teller = $teller + 1
$stel = 0
while $stel < $dServerTel
$stel = $stel + 1
if addprinterconnection($dServers[$stel] + "\" + $dGroepen[$teller]) = 0
at($Drivelijn, 68) $dGroepen[$teller]
if $DriveLijn < 22
$DriveLijn = $DriveLijn + 1
endif
endif
loop
loop
endif


; ; execute eventual scripts that are bound to printers
$teller = 0
while $teller < $dGroepTel
$teller = $teller + 1
if exist (@lserver + "\netlogon\gscripts\" + $dGroepen[$teller] + ".kix")
call @lserver + "\netlogon\gscripts\" + $dGroepen[$teller] + ".kix"
endif
loop

; Start an epilogue-script if one present
if exist (@lserver + "\netlogon\gscripts\Epiloog.kix")
call @lserver + "\netlogon\gscripts\Epiloog.kix"
endif


; Exit and Show user that script has end
color w/n
box(18, 3, 18, 38, " ")

settime $TimeServer

$klaar = messagebox (@fullname + ",

U bent nu succesvol aangemeld op het netwerk.
Zijn vermelde gegevens correct? Zoniet, gelieve dit te melden aan uw DIC!", "Mededeling", 64, 7)


Top
Page 2 of 2 <12


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 837 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.091 seconds in which 0.059 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org