Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populating the "Country" field in AD 1

Status
Not open for further replies.

JazzFan

Technical User
Apr 8, 2003
18
0
0
US
I am trying to fill in the fields of the address tab for users' properties in AD. Everything is working fine except for the country field. I get -2147016657 as err.number. Here's basically what I've got:

Option explicit
Const INPUT_FILE_NAME = "C:\Scripts\WMI\Testers\emplist1.txt"
Const COUNTRY = "United States"

Dim strLastName, strFirstName, strName, strExt, strTitle, strSubTitle, strDept
Dim objFSO, objFile, strLine, arrEmployees, i, k, l, strPhone, objUser


Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(INPUT_FILE_NAME, FOR_READING)
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine

'****************************************************
' Process each employee
'****************************************************
Set objUser = GetObject("LDAP://CN=" & strName & _
",OU=XPUsers,DOMAIN INFo HERE")
objUser.Put "c", COUNTRY
objUser.SetInfo
if err<>0 then
wscript.echo err.number
err.clear
end if
Loop
objFile.Close
Set objUser = Nothing

Thanks in advance for your help and have a great day!
jazzfan
 
JazzFan,

Try this instead.
[tt]
objUser.Put "c[red]o[/red]", COUNTRY
[/tt]
with "co" (text-country).

regards - tsuji
 
actually, what you'll want to do is set the COUNTRY constant to "US".

Those values accept ISO standard 2-character values
 
Thank you very much, rescueswimmer. That did the trick.
I think you should have a star.
jazzfan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top