Re: Importing users from CSV to Active Directory Domain by Michael
Michael
Fri Jul 11 04:20:46 CDT 2003
When you split you can use any character. What are you trying to do?
--
Regards,
Michael Holzemer
Please reply in newsgroup
*************************************************
"bpostiau" <bpostiau@nospam.com> wrote in message
news:uQsFKy4RDHA.2188@TK2MSFTNGP10.phx.gbl...
> Hi,
> just a remarq, as I've tried to script updates through scripting. the
split
> won't work, as there are commas in the
> dn path... If someone found a solution for this, let me know, as I had to
go
> in excel to avoid this.
>
> Tia
>
> Bruno
>
>
> "Michael Holzemer" <mike@autotown.com> wrote in message
> news:O8fd1DYRDHA.2228@tk2msftngp13.phx.gbl...
> > You could try this to start with. It should help you along.
> >
> >
> > Dim sCN, sLogon, sPass, sLine, aLine
> > Const ADS_PROPERTY_APPEND = 3
> > Const ForReading = 1
> >
> > Set oFSO = CreateObject("scripting.filesystemobject")
> > Set oTF = oFSO.OpenTextFile("C:\mycsvfile.csv",ForReading,True)
> > Do While oTF.AtEndOfStream <> True
> > sLine = oTF.ReadLine
> > aLine = split(sline, ",",-1,1)
> > sCN = aLine(0) & " " & aline(1)
> > sLogon = aLine(2)
> > sPass = aLine(3)
> > sScript = aLine(4)
> > sProfile = aline(5) ' "\\10.168.0.150\group\profile"
> > sOU = aline(6)
> > sGroup = aLine(7)
> >
> > Set objOU = GetObject("LDAP://ou=" & sOU &
> > ",ou=Dealerships,dc=dtrak,dc=autotown,dc=com")
> > Set objGroup = GetObject("LDAP://cn=" & sGroup & ",ou=" & sOU &
> > ",ou=Dealerships,dc=child,dc=foo,dc=com")
> > Set objUser = objOU.Create("user", "cn=" & sCN)
> > 'On Error Resume Next
> > objuser.put "sAMAccountName", sLogon
> > objuser.put "givenName", aLine(0)
> > objuser.put "sn", aline(1)
> > objuser.put "userPrincipalName", sLogon & "@child.foo.com"
> > objuser.put "DisplayName", sCN
> > objuser.put "name", sCN
> > objuser.put "profilepath", sProfile
> > objuser.put "scriptpath", sScript
> > objuser.accountexpirationdate = "01/01/1970"
> > objUser.SetInfo
> > objUser.setpassword sPass
> > objGroup.PutEx ADS_PROPERTY_APPEND, "member", Array("cn=" & sCN & ",ou="
&
> > sOU & ",ou=Dealerships,dc=child,dc=foo,dc=com")
> > objGroup.SetInfo
> > Loop
> >
> > msgbox "Done"
> > --
> > Regards,
> >
> > Michael Holzemer
> >
> > Please reply in newsgroup
> > *************************************************
> >
> >
> > "Kitt_uk" <kitt_uk@ntlworld.com> wrote in message
> > news:DGDOa.743$pQ2.47451@newsfep1-win.server.ntli.net...
> > > Help please.
> > >
> > > I have a csv file....something like...
> > >
> > > Blah, Blah, Blah, User, Blah, User group, Blah, Email, OU's ......etc.
> > >
> > > I wish to import as much data as possable to a new Win2k Domain. And
at
> > the
> > > same time add users to the relevent OU's.
> > >
> > > Where do I start ....
> > >
> > > Many Thanks
> > >
> > > Kev
> > >
> > >
> >
> >
>
>