Following modified code maps network shares. A definition file netmap.ini holds the necessary data.



 Code:

;Script Options
;Break ON
CLS

$bDEBUG=1
$sShareIni= @SCRIPTDIR + "\NetMap.ini"

If ReadProfileString($sShareIni,"","")
	If $bDEBUG
		"DEBUG: Die folgenden Sektionen erscheinen in der INI.-Datei:" ?
		"-----------------------------------------------------" ?
		ReadProfileString($sShareIni,"","")
		"-----------------------------------------------------" ?
	EndIf
Else
	If Exist($sShareIni)
		"ERROR: INI-Datei '"+$sShareIni+"' ist leer oder ungültig!" ?
	Else
		"ERROR: INI-Datei '"+$sShareIni+"' existiert nicht!" ?
	EndIf
	Exit 1
EndIf

Use * /delete

$iIndex=0
$iDefaultDone=0
$sGroup=EnumGroup($iIndex)
While $sGroup AND Not @FEHLER
	; Wegfallenlassen des Domainteils nlkhhi\
	If InStr($sGroup,"\") $sGroup=SubStr($sGroup,InStr($sGroup,"\")+1) EndIf
	If $bDEBUG Color w+/b "DEBUG: Looking for section [LOCATION "+$sGroup+"]" Color w/n ? EndIf
	; Überprüfung, ob eine Netzwerkmapping für die Gruppe da ist.
	For Each $sShare in Split(ReadProfileString($sShareIni,"LOCATION "+$sGroup,""),Chr(10))
		If $sShare
			$asSharePair=Split(ReadProfileString($sShareIni,"LOCATION "+$sGroup,$sShare),"|")
			
			DIM $Befehl1
			$Befehl1 = $asSharePair[0]+$asSharePair[1]
			DIM $Befehl2
			$Befehl2= $asSharePair[0]+$asSharePair[2]
			"Mappe alternativen Netzwerkpfad "+$asSharePair[1]+" auf "+$asSharePair[0] @CRLF
			If Execute( 'USE $Befehl1' )
				"  " Color r+/n "*Fehlgeschlagen*" Color w/n @CRLF
				"Mappe alternativen Netzwerkpfad "+$asSharePair[2]+" auf "+$asSharePair[0] @CRLF
				If Execute( 'USE $Befehl2' )
					"  " Color r+/n "*Ebenfalls Fehlgeschlagen*" Color w/n @CRLF
					"Grund: ["+@ERROR+"] "+@SERROR+@CRLF
				Else
					"  " Color g+/n "OK" Color w/n @CRLF
				EndIf
			Else
				"  " Color g+/n "OK" Color w/n @CRLF

			EndIf
		EndIf
	Next
	$iIndex=$iIndex+1
	$sGroup=EnumGroup($iIndex)
Loop


Exit 0



netmap.ini
! caution: the delimiter '|' is followed by a blank !

 Code:

[LOCATION AD_map]
ad=W:| "\\FS03\Daten"| "\\FS02\Daten"




Edited by mikeemikee (2007-07-03 10:53 AM)