I am looping through a file reading user names and trying to modiy the
telephone notes for each account using the below and can't get it to work?

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("c:\dictionary.txt", 1)
Do While objFile.AtEndOfStream = False
strName = objFile.ReadLine
strContainer = "CN=Users,DC=remote,DC=agilent,DC=com"

Set objItem = GetObject("LDAP://CN=" & strName & "," & strContainer)
End If
On Error Resume Next
Const ADS_PROPERTY_UPDATE = 2
objUser.Put "info", "Informational Text"
objUser.PutEx ADS_PROPERTY_UPDATE, _
"info", Array("Informational Text")
objUser.SetInfo
Loop

Re: Need Help by Ray

Ray
Thu Jan 06 15:37:31 CST 2005

"can't get it to work" means what? Do you get an error? If so, what
does it say? On what line does it occur?

--

Ray at work
Microsoft ASP/ASP.NET MVP


"D-a-n_L" <djlajoie@hotmail.com> wrote in message
news:%23sOu3aD9EHA.3700@tk2msftngp13.phx.gbl...
> I am looping through a file reading user names and trying to modiy
the
> telephone notes for each account using the below and can't get it
to work?
>
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> Set objFile = objFSO.OpenTextFile("c:\dictionary.txt", 1)
> Do While objFile.AtEndOfStream = False
> strName = objFile.ReadLine
> strContainer = "CN=Users,DC=remote,DC=agilent,DC=com"
>
> Set objItem = GetObject("LDAP://CN=" & strName & "," &
strContainer)
> End If
> On Error Resume Next
> Const ADS_PROPERTY_UPDATE = 2
> objUser.Put "info", "Informational Text"
> objUser.PutEx ADS_PROPERTY_UPDATE, _
> "info", Array("Informational Text")
> objUser.SetInfo
> Loop
>
>
>



Re: Need Help by D-a-n_L

D-a-n_L
Thu Jan 06 16:36:17 CST 2005

Oops, sorry

"test.vbs(7, 1) Microsoft VBScript compilation error: Expected statement"

"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:uQEAvfD9EHA.3616@TK2MSFTNGP11.phx.gbl...
> "can't get it to work" means what? Do you get an error? If so, what
> does it say? On what line does it occur?
>
> --
>
> Ray at work
> Microsoft ASP/ASP.NET MVP
>
>
> "D-a-n_L" <djlajoie@hotmail.com> wrote in message
> news:%23sOu3aD9EHA.3700@tk2msftngp13.phx.gbl...
> > I am looping through a file reading user names and trying to modiy
> the
> > telephone notes for each account using the below and can't get it
> to work?
> >
> > Set objFSO = CreateObject("Scripting.FileSystemObject")
> > Set objFile = objFSO.OpenTextFile("c:\dictionary.txt", 1)
> > Do While objFile.AtEndOfStream = False
> > strName = objFile.ReadLine
> > strContainer = "CN=Users,DC=remote,DC=agilent,DC=com"
> >
> > Set objItem = GetObject("LDAP://CN=" & strName & "," &
> strContainer)
> > End If
> > On Error Resume Next
> > Const ADS_PROPERTY_UPDATE = 2
> > objUser.Put "info", "Informational Text"
> > objUser.PutEx ADS_PROPERTY_UPDATE, _
> > "info", Array("Informational Text")
> > objUser.SetInfo
> > Loop
> >
> >
> >
>
>



Re: Need Help by jeff

jeff
Thu Jan 06 17:34:27 CST 2005

On Thu, 6 Jan 2005 14:36:17 -0800, "D-a-n_L" <djlajoie@hotmail.com>
wrote:

>Oops, sorry
>
>"test.vbs(7, 1) Microsoft VBScript compilation error: Expected statement"

Guessing that line 7 is:

End If

Then you probably should have put an IF statement somewhere above it.
That or used an END WHILE to end your DO WHILE loop... :)

Jeff

>
>"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
>message news:uQEAvfD9EHA.3616@TK2MSFTNGP11.phx.gbl...
>> "can't get it to work" means what? Do you get an error? If so, what
>> does it say? On what line does it occur?
>>
>> --
>>
>> Ray at work
>> Microsoft ASP/ASP.NET MVP
>>
>>
>> "D-a-n_L" <djlajoie@hotmail.com> wrote in message
>> news:%23sOu3aD9EHA.3700@tk2msftngp13.phx.gbl...
>> > I am looping through a file reading user names and trying to modiy
>> the
>> > telephone notes for each account using the below and can't get it
>> to work?
>> >
>> > Set objFSO = CreateObject("Scripting.FileSystemObject")
>> > Set objFile = objFSO.OpenTextFile("c:\dictionary.txt", 1)
>> > Do While objFile.AtEndOfStream = False
>> > strName = objFile.ReadLine
>> > strContainer = "CN=Users,DC=remote,DC=agilent,DC=com"
>> >
>> > Set objItem = GetObject("LDAP://CN=" & strName & "," &
>> strContainer)
>> > End If
>> > On Error Resume Next
>> > Const ADS_PROPERTY_UPDATE = 2
>> > objUser.Put "info", "Informational Text"
>> > objUser.PutEx ADS_PROPERTY_UPDATE, _
>> > "info", Array("Informational Text")
>> > objUser.SetInfo
>> > Loop
>> >
>> >
>> >
>>
>>
>


Re: Need Help by D-a-n_L

D-a-n_L
Fri Jan 07 11:10:51 CST 2005

I changed it to the below and it runs without error but doesn't put the text
in the telephone notes field? What I want to do is loop through a file
reading user names and and modify the telephone notes field in each account.

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\dictionary.txt", 1)
Do While objFile.AtEndOfStream = False
strName = objFile.ReadLine
strContainer = "CN=Users,DC=remote,DC=wireless,DC=com"
Set objItem = GetObject("LDAP://CN=" & strName & "," & strContainer)
On Error Resume Next
Const ADS_PROPERTY_UPDATE = 2
objUser.Put "info", "Informational Text"
objUser.PutEx ADS_PROPERTY_UPDATE, _
"info", Array("Informational Text")
objUser.SetInfo
Loop



Re: Need Help by jeff

jeff
Sun Jan 09 07:50:49 CST 2005

On Fri, 7 Jan 2005 09:10:51 -0800, "D-a-n_L" <djlajoie@hotmail.com>
wrote:

>I changed it to the below and it runs without error but doesn't put the text
>in the telephone notes field? What I want to do is loop through a file
>reading user names and and modify the telephone notes field in each account.
>
>Set objFSO = CreateObject("Scripting.FileSystemObject")
>Set objFile = objFSO.OpenTextFile("C:\dictionary.txt", 1)
>Do While objFile.AtEndOfStream = False
> strName = objFile.ReadLine
> strContainer = "CN=Users,DC=remote,DC=wireless,DC=com"
>Set objItem = GetObject("LDAP://CN=" & strName & "," & strContainer)
>On Error Resume Next
>Const ADS_PROPERTY_UPDATE = 2
>objUser.Put "info", "Informational Text"
>objUser.PutEx ADS_PROPERTY_UPDATE, _
>"info", Array("Informational Text")
>objUser.SetInfo
>Loop

Remove the On Error statement and see what errors you get.

Jeff

Re: Need Help by D-a-n_L

D-a-n_L
Mon Jan 10 11:31:28 CST 2005

Now I get?

test.vbs(8, 1) Microsoft VBScript runtime error: Object
required: 'objUser'

"Jeff Cochran" <jeff.nospam@zina.com> wrote in message
news:41eb369b.168887086@msnews.microsoft.com...
> On Fri, 7 Jan 2005 09:10:51 -0800, "D-a-n_L" <djlajoie@hotmail.com>
> wrote:
>
> >I changed it to the below and it runs without error but doesn't put the
text
> >in the telephone notes field? What I want to do is loop through a file
> >reading user names and and modify the telephone notes field in each
account.
> >
> >Set objFSO = CreateObject("Scripting.FileSystemObject")
> >Set objFile = objFSO.OpenTextFile("C:\dictionary.txt", 1)
> >Do While objFile.AtEndOfStream = False
> > strName = objFile.ReadLine
> > strContainer = "CN=Users,DC=remote,DC=wireless,DC=com"
> >Set objItem = GetObject("LDAP://CN=" & strName & "," & strContainer)
> >On Error Resume Next
> >Const ADS_PROPERTY_UPDATE = 2
> >objUser.Put "info", "Informational Text"
> >objUser.PutEx ADS_PROPERTY_UPDATE, _
> >"info", Array("Informational Text")
> >objUser.SetInfo
> >Loop
>
> Remove the On Error statement and see what errors you get.
>
> Jeff



Re: Need Help by Torgeir

Torgeir
Mon Jan 10 12:12:09 CST 2005

D-a-n_L wrote:

> Now I get?
>
> test.vbs(8, 1) Microsoft VBScript runtime error: Object
> required: 'objUser'
Hi

This because instead of

Set objItem = GetObject("LDAP://CN=" & strName & "," & strContainer)

you need

Set objUser = GetObject("LDAP://CN=" & strName & "," & strContainer)


--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx

Re: Need Help by D-a-n_L

D-a-n_L
Tue Jan 11 09:27:37 CST 2005

Now I get:

test.vbs(7, 1) Microsoft VBScript runtime error: Name re
defined: 'ADS_PROPERTY_UPDATE'

"Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
news:e12hIA09EHA.3260@TK2MSFTNGP14.phx.gbl...
> D-a-n_L wrote:
>
> > Now I get?
> >
> > test.vbs(8, 1) Microsoft VBScript runtime error: Object
> > required: 'objUser'
> Hi
>
> This because instead of
>
> Set objItem = GetObject("LDAP://CN=" & strName & "," & strContainer)
>
> you need
>
> Set objUser = GetObject("LDAP://CN=" & strName & "," & strContainer)
>
>
> --
> torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of
> the 1328 page Scripting Guide:
> http://www.microsoft.com/technet/scriptcenter/default.mspx



Re: Need Help by Ray

Ray
Tue Jan 11 09:42:14 CST 2005

That means you have Dim ADS_PROPERTY_UPDATE twice.

--

Ray at work
Microsoft ASP/ASP.NET MVP


"D-a-n_L" <djlajoie@hotmail.com> wrote in message
news:%23EVXWI$9EHA.3336@TK2MSFTNGP11.phx.gbl...
> Now I get:
>
> test.vbs(7, 1) Microsoft VBScript runtime error: Name re
> defined: 'ADS_PROPERTY_UPDATE'
>
> "Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
> news:e12hIA09EHA.3260@TK2MSFTNGP14.phx.gbl...
> > D-a-n_L wrote:
> >
> > > Now I get?
> > >
> > > test.vbs(8, 1) Microsoft VBScript runtime error: Object
> > > required: 'objUser'
> > Hi
> >
> > This because instead of
> >
> > Set objItem = GetObject("LDAP://CN=" & strName & "," & strContainer)
> >
> > you need
> >
> > Set objUser = GetObject("LDAP://CN=" & strName & "," & strContainer)
> >
> >
> > --
> > torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
> > Administration scripting examples and an ONLINE version of
> > the 1328 page Scripting Guide:
> > http://www.microsoft.com/technet/scriptcenter/default.mspx
>
>



Re: Need Help by Torgeir

Torgeir
Tue Jan 11 09:44:40 CST 2005

D-a-n_L wrote:

> Now I get:
>
> test.vbs(7, 1) Microsoft VBScript runtime error: Name re
> defined: 'ADS_PROPERTY_UPDATE'
Hi

A constant can only can be defined once in a script, but because
you define a constant inside a loop, you end up with this error.

Put the line
Const ADS_PROPERTY_UPDATE = 2
outside the Do While loop (e.g. at the top of your script).


--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx

Re: Need Help by D-a-n_L

D-a-n_L
Tue Jan 11 10:26:43 CST 2005

That's the ticket! Another script ready for the world, thanks all!!!

"Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
news:O237gS$9EHA.3420@TK2MSFTNGP10.phx.gbl...
> D-a-n_L wrote:
>
> > Now I get:
> >
> > test.vbs(7, 1) Microsoft VBScript runtime error: Name re
> > defined: 'ADS_PROPERTY_UPDATE'
> Hi
>
> A constant can only can be defined once in a script, but because
> you define a constant inside a loop, you end up with this error.
>
> Put the line
> Const ADS_PROPERTY_UPDATE = 2
> outside the Do While loop (e.g. at the top of your script).
>
>
> --
> torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of
> the 1328 page Scripting Guide:
> http://www.microsoft.com/technet/scriptcenter/default.mspx