Så kommer der lige en lidt ændret udgave af scriptet :
Læg mærke til, at vi nu instantierer shelle objektet også, så vi kan afvikle cmd kommandoer.
Desuden har jeg puttet lidt ekstra ind efter der hvor mappen dannes
Prøv den lige en gang :o)
TextXL = "c:\brugere.xls"
    Set shell = WScript.CreateObject("WScript.Shell")
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set oXL = WScript.CreateObject("EXCEL.application")
    oXL.Visible = True
    oXL.workbooks.open TextXL
    oXL.sheets("Ark1").Activate
    oXL.ActiveSheet.range("A2").Activate
    WScript.Echo  oXL.activecell.Value 
    root = "dc=killerclown,dc=dk"
    oXL.activecell.offset(1, 0).Activate
    Do While oXL.activecell.Value <> ""      
        OU = oXL.activecell.offset(0, 6).Value
        Set oOU=GetObject("
LDAP://OU=" & OU & "," & root)
        Set u = oOU.Create("User", "cn=" & oXL.activecell.offset(0, 1).Value & " " & oXL.activecell.offset(0, 2).Value)
        DisplayNavn = oXL.activecell.offset(0, 1).Value + " " + oXL.activecell.offset(0, 2).Value
        u.Put "sAMAccountName", oXL.activecell.offset(0, 0).Value 
        u.Put "givenName", oXL.activecell.offset(0, 1).Value
        u.Put "sn", oXL.activecell.offset(0, 2).Value
        u.Put "userPrincipalName", oXL.activecell.offset(0, 0).Value & "@killerclown.dk"'UPN DOMÆNE
        u.Put "homeDrive", "Y:"
        u.Put "homeDirectory", "\\server\homedir\" & oXL.activecell.offset(0, 0).Value
        u.Put "displayName", DisplayNavn
        u.SetInfo
        U.SetPassword oXL.activecell.offset(0, 4).Value
        U.AccountDisabled = False
        u.setinfo
        dialinok = oXL.activecell.offset(0, 8).Value
        If UCase(dialinok) = "JA" Then        
            U.MsNPAllowDialin = True
            else
            U.MsNPAllowDialin = False
        End If
        U.SetInfo
        Set u = Nothing
        If Not fso.folderexists("\\poffis1\users$\" & oXL.activecell.offset(0, 0).Value) Then
        fso.createfolder("\\poffis1\users$\" & oXL.activecell.offset(0, 0).Value)
        End If
  '      WScript.Sleep 50000
 '      strfjernrettighed = "%comspec% /c cacls \\poffis1\users$\" & oXL.activecell.offset(0, 0).Value & " /E /R killerclown\users"
'shell.run strfjernrettighed,0,True
strrettighed = "%comspec% /c cacls \\poffis1\users$\" & oXL.activecell.offset(0, 0).Value & " /E /G " & oXL.activecell.offset(0, 0).Value & ":F"
shell.run strrettighed,0,True
        oXL.activecell.offset(1, 0).Activate
    Loop
oXL.application.quit
Wscript.Echo    "Færdig !!!!"
strrettighed = "%comspec% /c cacls \\poffis1\users$\" & oXL.activecell.offset(0, 0).Value & " /E /G " & oXL.activecell.offset(0, 0).Value & ":F"
shell.run strrettighed,0,True
TextXL = "c:\userlist.xls"
    Set shell = WScript.CreateObject("WScript.Shell")
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set oXL = WScript.CreateObject("EXCEL.application")
    oXL.Visible = True
    oXL.workbooks.open TextXL
    oXL.sheets("Ark1").Activate
    oXL.ActiveSheet.range("A2").Activate
    WScript.Echo  oXL.activecell.Value 
    root = "dc=testdom,dc=local"
    oXL.activecell.offset(1, 0).Activate
    Do While oXL.activecell.Value <> ""      
        OU = oXL.activecell.offset(0, 6).Value
        Set oOU=GetObject("
LDAP://OU=" & OU & "," & root)
        Set u = oOU.Create("User", "cn=" & oXL.activecell.offset(0, 1).Value & " " & oXL.activecell.offset(0, 2).Value)
        DisplayNavn = oXL.activecell.offset(0, 1).Value + " " + oXL.activecell.offset(0, 2).Value
        u.Put "sAMAccountName", oXL.activecell.offset(0, 0).Value 
        u.Put "givenName", oXL.activecell.offset(0, 1).Value
        u.Put "sn", oXL.activecell.offset(0, 2).Value
        u.Put "userPrincipalName", oXL.activecell.offset(0, 0).Value & "@testdom.local"'UPN DOMÆNE
        u.Put "homeDrive", "Y:"
        u.Put "homeDirectory", "\\server\homedir\" & oXL.activecell.offset(0, 0).Value
        u.Put "displayName", DisplayNavn
        u.SetInfo
        U.SetPassword oXL.activecell.offset(0, 4).Value
        U.AccountDisabled = False
        u.setinfo
        dialinok = oXL.activecell.offset(0, 8).Value
        If UCase(dialinok) = "JA" Then        
            U.MsNPAllowDialin = True
            else
            U.MsNPAllowDialin = False
        End If
        U.SetInfo
        Set u = Nothing
        If Not fso.folderexists("\\server\homedir\" & oXL.activecell.offset(0, 0).Value) Then
        fso.createfolder("\\server\homedir\" & oXL.activecell.offset(0, 0).Value)
        End If
        strrettighed = "%comspec% /c cacls \\server\homedir\" & oXL.activecell.offset(0, 0).Value & " /E /G " & oXL.activecell.offset(0, 0).Value & ":F"
        shell.run strrettighed,0,True
        oXL.activecell.offset(1, 0).Activate
    Loop
oXL.application.quit
Wscript.Echo    "Færdig !!!!"