LDIFDE - Change Data Import Back to Domain

JB

Distinguished
Mar 30, 2004
365
0
18,780
Archived from groups: microsoft.public.win2000.active_directory (More info?)

I want to add a digit to user's phone numbers for particular OUs. The
users phone numbers are all different however the digit being added
will be the same for all users in the particular OU.

I have sucessfully exported user accounts for a specific ou but am not
sure how to import the change back in. Should I use the CSVDE utility?

Any suggestions?
 

JB

Distinguished
Mar 30, 2004
365
0
18,780
Archived from groups: microsoft.public.win2000.active_directory (More info?)

Yes correct however in order to import this file back in to the same AD
environment I have to hack the file up which would be quite time
consuming. For instance here is what my exported file looks like, minus
several hundred users.

DN,cn
"CN=Account 1,OU=NewBrunswick,DC=Any,DC=com",Account 1
"CN=Account 2,OU=NewBrunswick,DC=Any,DC=com",Account 2
"CN=CN=Account 3,OU=NewBrunswick,DC=Any,DC=com",Account 3
"CN=Account 4,OU=NewBrunswick,DC=Any,DC=com",Account 4

Now in order to make the change to the telephone I would have to do the
following:

dn: CN=Account 1,OU=NewBrunswick,DC=Any,DC=com
changetype: modify
replace: telephonenumber
telephonenumber: 732-249-7600
-

dn: CN=Account 2,OU=NewBrunswick,DC=Any,DC=com
changetype: modify
replace: telephonenumber
telephonenumber: 732-249-7600
-

dn: CN=Account 3,OU=NewBrunswick,DC=Any,DC=com
changetype: modify
replace: telephonenumber
telephonenumber: 732-249-7600
-

dn: CN=Account 4,OU=NewBrunswick,DC=Any,DC=com
changetype: modify
replace: telephonenumber
telephonenumber: 732-249-7600
-

The idea is that I would like to be able to do this with a little less
effort.
 

JB

Distinguished
Mar 30, 2004
365
0
18,780
Archived from groups: microsoft.public.win2000.active_directory (More info?)

Tried that as well. I have to make the change to the users one at a
time using this tool, at least I believe so, I posted a question to the
message board concerning this. It is definately more efficient then AD
User and Computers. But still not terribly efficient.
 

JB

Distinguished
Mar 30, 2004
365
0
18,780
Archived from groups: microsoft.public.win2000.active_directory (More info?)

Do not have a clue on how to use it any help would be much appreciated.
I will research this myself how to do it but I do not have any
experience with it.
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.active_directory (More info?)

JB wrote:
> I want to add a digit to user's phone numbers for particular OUs. The
> users phone numbers are all different however the digit being added
> will be the same for all users in the particular OU.
>
> I have sucessfully exported user accounts for a specific ou but am not
> sure how to import the change back in. Should I use the CSVDE utility?
>
> Any suggestions?

IF You exported this data using ldifde You can also import it using ldifde

--
Tomasz Onyszko [MVP]
T.Onyszko@w2k.pl
http://www.w2k.pl
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.active_directory (More info?)

JB wrote:
> Yes correct however in order to import this file back in to the same AD
> environment I have to hack the file up which would be quite time
(...)


> The idea is that I would like to be able to do this with a little less
> effort.

1. Simple ADSI script
2. ADmodify .NET (i'm not sure You can do this with this tool but try)
http://www.gotdotnet.com/workspaces/workspace.aspx?id=f5cbbfa9-e46b-4a7a-8ed8-3e44523f32e2



--
Tomasz Onyszko [MVP]
T.Onyszko@w2k.pl
http://www.w2k.pl
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.active_directory (More info?)

JB wrote:
> Tried that as well. I have to make the change to the users one at a
> time using this tool, at least I believe so, I posted a question to the
> message board concerning this. It is definately more efficient then AD
> User and Computers. But still not terribly efficient.
>
Use ADSI script

--
Tomasz Onyszko [MVP]
T.Onyszko@w2k.pl
http://www.w2k.pl
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.active_directory (More info?)

JB wrote:
> Do not have a clue on how to use it any help would be much appreciated.
> I will research this myself how to do it but I do not have any
> experience with it.
>
for single user:
<code>
Set objUser = GetObject("LDAP://" & userDN )

objUser.Put "homePhone", objUser.Get("homePhone") & "7555"
objUSer.SetInfo
</code>

where userDN is distinguished name of user ex:
CN=Jan,OU=Test,DC=example,DC=COM


For all users in specified OU:
<code>
Set objOU = GetObject("LDAP://" & objOUPath)
objOU.Filter = Array("user")
For each objUser in objOU
objUser.Put "homePhone", objUser.Get("homePhone") & "7555"
objUSer.SetInfo
Next
</code>

where objOUPAth is OU=Test,DC=example,DC=Com

Of course this is simplest possible code

--
Tomasz Onyszko [MVP]
T.Onyszko@w2k.pl
http://www.w2k.pl
 

JB

Distinguished
Mar 30, 2004
365
0
18,780
Archived from groups: microsoft.public.win2000.active_directory (More info?)

You have been very helpful thank you is there anyway I can push my luck
and ask for further assistance.I have modified the code that you have
given me as follows:

<code>
Set objUser = GetObject("LDAP://" & CN=John
Doe,CN=Users,DC=Domain,DC=com )

objUser.Put "telephonenumber", objUser.Get("telephonenumber") & "7555"
objUSer.SetInfo
</code>

Saved the notepad file with vbs extension and then when I run it I get
the following error.

Windows Script Host
Line: 1
Char: 1
Error: Expected Statement
Code: 800A0400
Source: Microsoft VBScript Compilation Error
 

JB

Distinguished
Mar 30, 2004
365
0
18,780
Archived from groups: microsoft.public.win2000.active_directory (More info?)

Been Playing and changed the script as follows:

Set objUser = GetObject("LDAP://" & "CN=John
Doe,CN=Users,DC=Domain,DC=com")
objUser.Put "TelephoneNumber", objUser.Get("TelephoneNumber") & "7555"
objUSer.SetInfo

Now I receive the following error:
Windows Script Host
Line: 2
Char: 1
Error: The directory property cannot be found in the cache
Code: 8000500D
Source: Active Directory
 

JB

Distinguished
Mar 30, 2004
365
0
18,780
Archived from groups: microsoft.public.win2000.active_directory (More info?)

After looking at your script I have come to the conclusion that it may
be easier to just use a script like this to specify the entire number
instead of having it edit the existing number. It is a four digit
number and would still be much quicker if I could use something like
this as opposed to the other methods I have been toying with.

Can you help me with modifying this script to accomplish this?
 

JB

Distinguished
Mar 30, 2004
365
0
18,780
Archived from groups: microsoft.public.win2000.active_directory (More info?)

You may have moved on to bigger and better things. FYI for anyone that
may come accross the same. Here is the code to make the necessary
changes on a per user basis, I would now like to feed this a csv file
with multiple users and phone numbers:

Const ADS_PROPERTY_UPDATE = 2

'Need to duplicate all of the following for multiple accounts.

Set objUser = GetObject _
("LDAP://CN=USERNAME,OU=ORGANIZATIONALUNIT,DC=DOMAINNAME,DC=COM")

objUser.Put "telephoneNumber", "EXT"

objUser.SetInfo
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.active_directory (More info?)

JB wrote:
> You may have moved on to bigger and better things. FYI for anyone that

Not, not moved - just long day at work :)

> may come accross the same. Here is the code to make the necessary
> changes on a per user basis, I would now like to feed this a csv file
> with multiple users and phone numbers:
>
> Const ADS_PROPERTY_UPDATE = 2
>
> 'Need to duplicate all of the following for multiple accounts.
>
> Set objUser = GetObject _
> ("LDAP://CN=USERNAME,OU=ORGANIZATIONALUNIT,DC=DOMAINNAME,DC=COM")
>
> objUser.Put "telephoneNumber", "EXT"
>
> objUser.SetInfo

Yes, this is completly good code. Few words of explanation for Your
previous posts:

<quote>
Error: The directory property cannot be found in the cache
</quote>
This message indicates that You were trying to read property that was
not initialized or the name was misspelled - If user has no value in
this property when You invoke Get method this error can occur.

first two errors are just syntax error

I'm glad thath You sucseeded on Your own - it always good to learn
something new, huh?

--
Tomasz Onyszko [MVP]
T.Onyszko@w2k.pl
http://www.w2k.pl