I am trying to run the below code however all it seems to do is freeze the DOS window and when I force that to clost logs my PC off .. what am I doing wrong?

Thanks
Andy

 Code:
;Enumerate all group for the current user.
$groups = arrayenumgroup()
;Start the magic for each group.
For Each $group in $groups
	;Read the number of drives to be mapped for each group.
	$drives = ReadProfileString("D:\My Dropbox\Specsavers\Login Scripts\Specsavers\DriveMapping.ini", $group, "NumberOfDrives")
	;Map each drive.
	For $i = 1 to $drives
		;Read drive data from ini file.
		$drive = ReadProfileString("D:\My Dropbox\Specsavers\Login Scripts\Specsavers\DriveMapping.ini", $group, "MapDrive" + $i)
		$drive = Split($drive, ",")
		;MapDrv ($drive[0],$drive[1],$drive[2])
		Use $drive[0] + ': "' + $drive[1] + '"'
	Next
Next

Exit

;DO NOT MODIFY ANYTHING BELOW THIS LINE.
;IT IS A UDF AND IT COMES READY FOR USE.

;NAME          ARRAYENUMGROUP
;
;AUTHOR        Jens Meyer (sealeopard@usa.net)
;
;ACTION        Creates an array of groups of which the current user is a member
;   
;SYNTAX        ARRAYENUMGROUP()
;  
;PARAMETERS    none
;
;RETURNS       Array containing the group names
; 
;REMARKS       none
;
;DEPENDENCIES  none
;  
;EXAMPLE       $retcode=arrayenumgroup()
;
Function arrayenumgroup()
	Dim $retcode, $valuecounter, $currentvalue, $valuearray
		  
	$valuecounter = 0
	Do
		$currentvalue = EnumGroup($valuecounter)
		If $currentvalue <> 259 And @ERROR = 0
			ReDim preserve $valuearray[$valuecounter]
			$valuearray[$valuecounter] = $currentvalue
			$valuecounter = $valuecounter + 1
		EndIf
	Until $currentvalue = 259 Or @ERROR
		  
	$arrayenumgroup = $valuearray
EndFunction


 Code:
; Drive mappings other than primary user, group and common drives

[Authenticated Users]
NumberOfDrives=2
MapDrive1=f,perseus,exporthome\andyn
MapDrive2=i,Perseus.gg.specsavers.com,SolarisOutput

[Domain Users]
NumberOfDrives=1
MapDrive1=t,Perseus,co-data


Edited by anaftel (2010-07-08 06:14 PM)