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

Re: Importing users from CSV to Active Directory Domain by Michael

Michael
Tue Jul 08 13:44:25 CDT 2003

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
>
>



Re: Importing users from CSV to Active Directory Domain by wrk

wrk
Tue Jul 08 18:11:02 CDT 2003

Here is a link to a question similar to yours...

http://www.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=ujypnU%23LBHA.2296%40tkmsftngp02&rnum=2&prev=/groups%3Fq%3Dread%2Bfield%2Bfrom%2Bcsv%2Bgroup:microsoft.public.scripting.*%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26selm%3DujypnU%2523LBHA.2296%2540tkmsftngp02%26rnum%3D2


"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
>
>



Re: Importing users from CSV to Active Directory Domain by bpostiau

bpostiau
Fri Jul 11 04:10:28 CDT 2003

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
> >
> >
>
>



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
> > >
> > >
> >
> >
>
>