$location = ReadProfileString ($LogonServer + "\NETLOGON\printer.ini", $mac, "Location")
$group = ReadProfileString ($LogonServer + "\NETLOGON\printer.ini", $mac, "Group")
$names = ReadProfileString ($LogonServer + "\NETLOGON\printer.ini", $mac, "Names")
$shares = ReadProfileString ($LogonServer + "\NETLOGON\printer.ini", $mac, "Shares")
If InStr($shares,",")
$names = Split($names,",")
$shares = Split($shares,",")
If UBound($names) <> UBound($shares)
$null = MessageBox("Der er uoverensstemmelse mellem Names og Shares. Kontroller printer.ini filen under sektionen : "+$mac,0)
Else
$sharenum = 0
For Each $share in $shares
$name = $names[$sharenum]
If InGroup($group)
If AddPrinterConnection("\\" + $printserver + "\" + $share) = 0
If $sharenum = UBound($shares)
$null = SetDefaultPrinter("\\" + $printserver + "\" + $name)
EndIf
Else
$null = MessageBox("2 Der er et problem med at etablerer forbindelse til : "+$share,"Printer fejl",0)
EndIf
EndIf
$sharenum = $sharenum+1
Next
EndIf
Else
If InGroup($group)
If AddPrinterConnection("\\" + $printserver + "\" + $shares) = 0
$null = SetDefaultPrinter("\\" + $printserver + "\" + $names)
Else
$null = MessageBox("2 Der er et problem med at etablerer forbindelse til : "+$shares,"Printer fejl",0)
EndIf
EndIf
EndIf