Thank you very much for all your help.

It is now running and create a user.

but i have now 2 other problems.

1) i want to read the second linie in data-file and do until EOF

2) I want to browse for a data-file, because the fil-name of data-file is varies

Dim $LoginName,
$NewUserAccount,
$Container,
$objGruppe1,
$objGruppe2,
$objGruppe3,
$filesys,
$filetxt,
$strTemp,
$strBruger,
$strPassword,
$strUdloeber,
$strHomedir,
$strUNCsti,
$strFilsti
$ForAppending
$ForWriting
$Forreading

$forAppending='8'
$ForWriting='2'
$Forreading='1'



;$filesys = CreateObject("Scripting.FileSystemObject")
;$filetxt = $filesys.OpenTextFile("052ve.ttx", $ForReading, 1)


Dim $lf, $f, $_,$t
$lf=chr(10)
$f=Freefilehandle

open($f, "052ve.ttx")
$strLDAP=readline($f)
$Container = GetObject($strLDAP)


;*** START LÆS I FIL ***

;* Sætter stien til AD. Første linie i test.txt.
If Not $filetxt.AtEndOfStream
$strLDAP = Replace(filetxt.ReadLine, " ", "")
EndIf
; should read the next line and curt the line in to pieces.
; Should do it until nu more linie in ttx-file.

; I WANT TO START TO READ THE sECOND LINE IN FILE
; AND Do aLL THE BELOW
;AND THE THE NExT LINE AND DO BELOW
; UNTIL EOF

DO
;* Brugernavn *
$strBruger = Left($strTemp, (InStr($strTemp, ",")) - 1)
? $strBruger
;* Fornavn *
$strTemp = Right($strTemp, Len($strTemp) - InStr($strTemp, ","))
$strFornavn = Left($strTemp, (InStr($strTemp, ",")) - 1)
? $strfornavn
;* Efternavn *
$strTemp = Right($strTemp, Len($strTemp) - InStr($strTemp, ","))
$strEfternavn = Left($strTemp, (InStr($strTemp, ",")) - 1)
? $strefternavn
;* Afdeling *
$strTemp = Right($strTemp, Len($strTemp) - InStr($strTemp, ","))
$strAfdeling = Left($strTemp, (InStr($strTemp, ",")) - 1)
? $strafdeling
;* Gruppe1 *
$strTemp = Right($strTemp, Len($strTemp) - InStr($strTemp, ","))
$strGruppe1 = Left($strTemp, (InStr($strTemp, ",")) - 1)
? $strgruppe1

;* Gruppe2 *
$strTemp = Right($strTemp, Len($strTemp) - InStr($strTemp, ","))
$strGruppe2 = Left($strTemp, (InStr($strTemp, ",")) - 1)
? $strgruppe2
;* Gruppe3 *
$strTemp = Right($strTemp, Len($strTemp) - InStr($strTemp, ","))
$strGruppe3 = Left($strTemp, (InStr($strTemp, ",")) - 1)
? $strgruppe3

;* Udløber *
$strTemp = Right($strTemp, Len($strTemp) - InStr($strTemp, ","))
$strUdloeber = Left($strTemp, (InStr($strTemp, ",")))
? $strudloeber

;* hold *
$strTemp = Right($strTemp, Len($strTemp) - InStr($strTemp, ","))
$strhold = Left($strTemp, (InStr($strTemp, ",")) - 1)
? $strhold

;* Password *
$strPassword = Right($strTemp, Len($strTemp) - InStr($strTemp, ","))
? $strpassword

;------------------------------------
;*Set userfolder UNC And drive SOSFELEV

If $strAfdeling="SOSHELEV"
? "UNCsti for Horsens"
;* UNCstien til userfolder
$strUNCsti = "\\SOSHELEV\DATA\hold\" + $strHold + "\"
;* filepath til userfolder On server SOSHELEV
strFilsti = "H:\hold\" + $strhold + "\"
EndIf
;*Set userfolder UNC And drive SOSFELEV

If $strAfdeling="SOSFELEV"
? "UNCsti for Fredericia"
;* UNCstien til userfolder
$strUNCsti = "\\SOSFELEV\DATA\hold\" + $strHold + "\"
? $strUNCsti
;* filepath til userfolder On server SOSFELEV
$strFilsti = "G:\hold\" + $strhold + "\"
? $strfilSti
sleep 2
EndIf

;* home directory
$strhomedir = $strUNCsti+$strBruger
;*** START inset In AD ***
;* connect To AF groups On SOSFELEV*
If $strAfdeling = "SOSHELEV"

? "er på horsens server"


$objGruppe1 = GetObject("LDAP://cn=" + $strGruppe1 + ",OU=grupper i horsens,OU=grupper,DC=sosva,DC=elev")
$objGruppe2 = GetObject("LDAP://cn=" + $strGruppe2 + ",OU=grupper i horsens,OU=grupper,DC=sosva,DC=elev")
$objGruppe3 = GetObject("LDAP://cn=" + $strGruppe3 + ",OU=grupper,DC=sosva,DC=elev")
EndIf
;* connect To AF groups On SOSFELEV*
If $strAfdeling="SOSFELEV"
? "er på Fredericia server"
$objGruppe1 = GetObject("LDAP://cn=$strGruppe1,OU=grupper i fredericia,OU=grupper,DC=sosva,DC=elev")
$objGruppe2 = GetObject("LDAP://cn=$strGruppe2,OU=grupper i fredericia,OU=grupper,DC=sosva,DC=elev")
$objGruppe3 = GetObject("LDAP://cn=$strGruppe3,OU=grupper,DC=sosva,DC=elev")

EndIf
? $strbruger


;* Opretter den nye bruger *
;Creates account
$AdsUser = $Container.Create("User","cn="+$strBruger)
;Sets login name
$AdsUser.Put("SamAccountName",$strBruger)
;Sets Fornavn
$AdsUser.Put("givenName",$strFornavn)
;Sets efternavn
$AdsUser.put("sn",$strEfternavn)
; $adsuser.Put("Description ",$strhold)
; ? "description" @error
; $Adsuser.SetInfo()
; ? "vi prøver lige her" @error @serror

;Sets Logonbat
$AdsUser.put("ScriptPath","wkix32.exe /i login.kix")


;Sets Homedir
$AdsUser.put("HomeDirectory",$strHomedir)
;Sets HomeDrive
$AdsUser.put("HomeDrive","T:")


;Sets logon W2k
$AdsUser.put("userPrincipalName",$strBruger)
;Sætter profil stien - Fjern ; nedenunder For at For profil stien med.
; $AdsUser.Put("profilePath",strUNCsti + strBruger + "\profil")
; ? "profil" @error

;Sets Password udløbet
; $AdsUser.pwdLastSet=-1
; ? "pwdlastset" @error
$Adsuser.SetInfo()


;Enables account
; sætter kodeord til at være udløbet og skal ændres
; NewUserAccount.UserAccountControl = NewUserAccountControl And Not +H200
$Adsuser.Put ("userAccountControl", (&200 | &10000))

;Sets password To password

$AdsUser.SetPassword($strPassword)
$Adsuser.SetInfo()

;Tilføjer bruger til grupper
$DomainString = @DOMAIN
$UserString = $strBruger
$GroupString = $strgruppe1
$GroupObj = GetObject("WinNT://" + $DomainString + "/" + $GroupString)
$GroupObj.Add ("WinNT://" + $DomainString + "/" + $UserString)
$DomainObj = ""
$GroupObj = ""


$GroupString = $strgruppe2
$GroupObj = GetObject("WinNT://" + $DomainString + "/" + $GroupString)
$GroupObj.Add ("WinNT://" + $DomainString + "/" + $UserString)
$DomainObj = ""
$GroupObj = ""

$GroupString = $strgruppe3
$GroupObj = GetObject("WinNT://" + $DomainString + "/" + $GroupString)
$GroupObj.Add ("WinNT://" + $DomainString + "/" + $UserString)
$DomainObj = ""
$GroupObj = ""


OpretMappe($strBruger,$strfilsti)

If @error
exit @error
endif

until @error

close($f)
;*** SLUT INDSÆT I AD ***

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

? "The command completed successfully."

Function OpretMappe($strUser,$strsti)
? "opret funktion"
sleep 1
? $strsti
? $strUser
$WshNetwork = CreateObject("Network")
$WshShell = CreateObject("Shell")
$newfolderpath = $strsti + $struser
? $newfolderpath

$filesys=CreateObject("Scripting.FileSystemObject")
If Not $filesys.FolderExists($newfolderpath)
$newfolder = $filesys.CreateFolder($newfolderpath)
EndIf
? $strsti
? $struser
Run "e:\elevoprettelse\xcacls.exe "+ $strsti + $strUser + " /p sosva-E\" + $strUser + ":c "+"sosva-E\domain-admins:F "+"sosva-e\SSA-laerer:F"+" /y"

sleep 5
; Run "xcacls.exe" + $strFilsti + $strUser + " /p sosva-E\" + $strUser + ":c "+"sosva-E\domain-admins:F "+"sosva-e\SSA-laerer:F"+" /y"

EndFunction

Function Replace($String,$SS,$RS)
$Replace=Join(Split($String,$SS),$RS)
EndFunction


1)