AD Telephone Number field name exported from VBS

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

I'm trying to create a vbs script that exports user information similar to
the lines below, but I would like to export the Telephone Number from the
General Tab of a user's properties in AD. Does anyone know what the & objUser
code is for the telephone number? I've searched the internet and tried many
different utilities (ADFIND, useraccount.vbs, listproperties.vbs) but I can't
find the field I require to output the telephone number.

str1 = "Last Login: " & objUser.LastLogin
str2 = "Last Logoff: " & objUser.LastLogoff
str3 = "Phone: " & objUser.?????
7 answers Last reply
More about telephone number field exported
  1. Archived from groups: microsoft.public.win2000.active_directory (More info?)

    The AD attribute is telephoneNumber.

    --
    Joe Richards Microsoft MVP Windows Server Directory Services
    www.joeware.net


    Joseph_01 wrote:
    > I'm trying to create a vbs script that exports user information similar to
    > the lines below, but I would like to export the Telephone Number from the
    > General Tab of a user's properties in AD. Does anyone know what the & objUser
    > code is for the telephone number? I've searched the internet and tried many
    > different utilities (ADFIND, useraccount.vbs, listproperties.vbs) but I can't
    > find the field I require to output the telephone number.
    >
    > str1 = "Last Login: " & objUser.LastLogin
    > str2 = "Last Logoff: " & objUser.LastLogoff
    > str3 = "Phone: " & objUser.?????
  2. Archived from groups: microsoft.public.win2000.active_directory (More info?)

    Thank you for your reply. I still fail to get any output from str3 in my
    script when I insert it as follows:

    str1 = "Last Login: " & objUser.LastLogin
    str2 = "Last Logoff: " & objUser.LastLogoff
    str3 = "Phone: " & objUser.telephoneNumber
    str4 = "Logon Count: " & objUser.logonCount

    When I run my script, str3 does not appear even though I have the telephone
    number field filled in. Perhaps this is a bug in my AD?

    "Joe Richards [MVP]" wrote:

    > The AD attribute is telephoneNumber.
    >
    > --
    > Joe Richards Microsoft MVP Windows Server Directory Services
    > www.joeware.net
    >
    >
    > Joseph_01 wrote:
    > > I'm trying to create a vbs script that exports user information similar to
    > > the lines below, but I would like to export the Telephone Number from the
    > > General Tab of a user's properties in AD. Does anyone know what the & objUser
    > > code is for the telephone number? I've searched the internet and tried many
    > > different utilities (ADFIND, useraccount.vbs, listproperties.vbs) but I can't
    > > find the field I require to output the telephone number.
    > >
    > > str1 = "Last Login: " & objUser.LastLogin
    > > str2 = "Last Logoff: " & objUser.LastLogoff
    > > str3 = "Phone: " & objUser.?????
    >
  3. Archived from groups: microsoft.public.win2000.active_directory (More info?)

    I would suspect your script before I would suspect AD.

    What does your bind look like?

    --
    Joe Richards Microsoft MVP Windows Server Directory Services
    www.joeware.net


    Joseph_01 wrote:
    > Thank you for your reply. I still fail to get any output from str3 in my
    > script when I insert it as follows:
    >
    > str1 = "Last Login: " & objUser.LastLogin
    > str2 = "Last Logoff: " & objUser.LastLogoff
    > str3 = "Phone: " & objUser.telephoneNumber
    > str4 = "Logon Count: " & objUser.logonCount
    >
    > When I run my script, str3 does not appear even though I have the telephone
    > number field filled in. Perhaps this is a bug in my AD?
    >
    > "Joe Richards [MVP]" wrote:
    >
    >
    >>The AD attribute is telephoneNumber.
    >>
    >>--
    >>Joe Richards Microsoft MVP Windows Server Directory Services
    >>www.joeware.net
    >>
    >>
    >>Joseph_01 wrote:
    >>
    >>>I'm trying to create a vbs script that exports user information similar to
    >>>the lines below, but I would like to export the Telephone Number from the
    >>>General Tab of a user's properties in AD. Does anyone know what the & objUser
    >>>code is for the telephone number? I've searched the internet and tried many
    >>>different utilities (ADFIND, useraccount.vbs, listproperties.vbs) but I can't
    >>>find the field I require to output the telephone number.
    >>>
    >>>str1 = "Last Login: " & objUser.LastLogin
    >>>str2 = "Last Logoff: " & objUser.LastLogoff
    >>>str3 = "Phone: " & objUser.?????
    >>
  4. Archived from groups: microsoft.public.win2000.active_directory (More info?)

    "Bind?" Please explain.

    The script I'm using is the useraccount.vbs script, and it works fine except
    for the telephonenumber line.

    "Joe Richards [MVP]" wrote:

    > I would suspect your script before I would suspect AD.
    >
    > What does your bind look like?
    >
    > --
    > Joe Richards Microsoft MVP Windows Server Directory Services
    > www.joeware.net
    >
    >
    > Joseph_01 wrote:
    > > Thank you for your reply. I still fail to get any output from str3 in my
    > > script when I insert it as follows:
    > >
    > > str1 = "Last Login: " & objUser.LastLogin
    > > str2 = "Last Logoff: " & objUser.LastLogoff
    > > str3 = "Phone: " & objUser.telephoneNumber
    > > str4 = "Logon Count: " & objUser.logonCount
    > >
    > > When I run my script, str3 does not appear even though I have the telephone
    > > number field filled in. Perhaps this is a bug in my AD?
    > >
    > > "Joe Richards [MVP]" wrote:
    > >
    > >
    > >>The AD attribute is telephoneNumber.
    > >>
    > >>--
    > >>Joe Richards Microsoft MVP Windows Server Directory Services
    > >>www.joeware.net
    > >>
    > >>
    > >>Joseph_01 wrote:
    > >>
    > >>>I'm trying to create a vbs script that exports user information similar to
    > >>>the lines below, but I would like to export the Telephone Number from the
    > >>>General Tab of a user's properties in AD. Does anyone know what the & objUser
    > >>>code is for the telephone number? I've searched the internet and tried many
    > >>>different utilities (ADFIND, useraccount.vbs, listproperties.vbs) but I can't
    > >>>find the field I require to output the telephone number.
    > >>>
    > >>>str1 = "Last Login: " & objUser.LastLogin
    > >>>str2 = "Last Logoff: " & objUser.LastLogoff
    > >>>str3 = "Phone: " & objUser.?????
    > >>
    >
  5. Archived from groups: microsoft.public.win2000.active_directory (More info?)

    The line with the getobject in it where you connect to the directory. Are you,
    by any chance using WinNT://

    --
    Joe Richards Microsoft MVP Windows Server Directory Services
    www.joeware.net


    Joseph_01 wrote:
    > "Bind?" Please explain.
    >
    > The script I'm using is the useraccount.vbs script, and it works fine except
    > for the telephonenumber line.
    >
    > "Joe Richards [MVP]" wrote:
    >
    >
    >>I would suspect your script before I would suspect AD.
    >>
    >>What does your bind look like?
    >>
    >>--
    >>Joe Richards Microsoft MVP Windows Server Directory Services
    >>www.joeware.net
    >>
    >>
    >>Joseph_01 wrote:
    >>
    >>>Thank you for your reply. I still fail to get any output from str3 in my
    >>>script when I insert it as follows:
    >>>
    >>>str1 = "Last Login: " & objUser.LastLogin
    >>>str2 = "Last Logoff: " & objUser.LastLogoff
    >>>str3 = "Phone: " & objUser.telephoneNumber
    >>>str4 = "Logon Count: " & objUser.logonCount
    >>>
    >>>When I run my script, str3 does not appear even though I have the telephone
    >>>number field filled in. Perhaps this is a bug in my AD?
    >>>
    >>>"Joe Richards [MVP]" wrote:
    >>>
    >>>
    >>>
    >>>>The AD attribute is telephoneNumber.
    >>>>
    >>>>--
    >>>>Joe Richards Microsoft MVP Windows Server Directory Services
    >>>>www.joeware.net
    >>>>
    >>>>
    >>>>Joseph_01 wrote:
    >>>>
    >>>>
    >>>>>I'm trying to create a vbs script that exports user information similar to
    >>>>>the lines below, but I would like to export the Telephone Number from the
    >>>>>General Tab of a user's properties in AD. Does anyone know what the & objUser
    >>>>>code is for the telephone number? I've searched the internet and tried many
    >>>>>different utilities (ADFIND, useraccount.vbs, listproperties.vbs) but I can't
    >>>>>find the field I require to output the telephone number.
    >>>>>
    >>>>>str1 = "Last Login: " & objUser.LastLogin
    >>>>>str2 = "Last Logoff: " & objUser.LastLogoff
    >>>>>str3 = "Phone: " & objUser.?????
    >>>>
  6. Archived from groups: microsoft.public.win2000.active_directory (More info?)

    Hello, I could not find what you meant by bind in the script. I'd post the
    script here but it's rather long. We are using the useraccount.vbs found in
    the Windows 2000 resource kit pretty much verbatim except for the
    telephone.number field that I am trying to get to work.

    We are on a Win2000 Advanced Server. :-)

    "Joe Richards [MVP]" wrote:

    > The line with the getobject in it where you connect to the directory. Are you,
    > by any chance using WinNT://
    >
    > --
    > Joe Richards Microsoft MVP Windows Server Directory Services
    > www.joeware.net
    >
    >
    > Joseph_01 wrote:
    > > "Bind?" Please explain.
    > >
    > > The script I'm using is the useraccount.vbs script, and it works fine except
    > > for the telephonenumber line.
    > >
    > > "Joe Richards [MVP]" wrote:
    > >
    > >
    > >>I would suspect your script before I would suspect AD.
    > >>
    > >>What does your bind look like?
    > >>
    > >>--
    > >>Joe Richards Microsoft MVP Windows Server Directory Services
    > >>www.joeware.net
    > >>
    > >>
    > >>Joseph_01 wrote:
    > >>
    > >>>Thank you for your reply. I still fail to get any output from str3 in my
    > >>>script when I insert it as follows:
    > >>>
    > >>>str1 = "Last Login: " & objUser.LastLogin
    > >>>str2 = "Last Logoff: " & objUser.LastLogoff
    > >>>str3 = "Phone: " & objUser.telephoneNumber
    > >>>str4 = "Logon Count: " & objUser.logonCount
    > >>>
    > >>>When I run my script, str3 does not appear even though I have the telephone
    > >>>number field filled in. Perhaps this is a bug in my AD?
    > >>>
    > >>>"Joe Richards [MVP]" wrote:
    > >>>
    > >>>
    > >>>
    > >>>>The AD attribute is telephoneNumber.
    > >>>>
    > >>>>--
    > >>>>Joe Richards Microsoft MVP Windows Server Directory Services
    > >>>>www.joeware.net
    > >>>>
    > >>>>
    > >>>>Joseph_01 wrote:
    > >>>>
    > >>>>
    > >>>>>I'm trying to create a vbs script that exports user information similar to
    > >>>>>the lines below, but I would like to export the Telephone Number from the
    > >>>>>General Tab of a user's properties in AD. Does anyone know what the & objUser
    > >>>>>code is for the telephone number? I've searched the internet and tried many
    > >>>>>different utilities (ADFIND, useraccount.vbs, listproperties.vbs) but I can't
    > >>>>>find the field I require to output the telephone number.
    > >>>>>
    > >>>>>str1 = "Last Login: " & objUser.LastLogin
    > >>>>>str2 = "Last Logoff: " & objUser.LastLogoff
    > >>>>>str3 = "Phone: " & objUser.?????
    > >>>>
    >
  7. Archived from groups: microsoft.public.win2000.active_directory (More info?)

    Hi,

    The variable objUser had to be created by binding (connecting) to the object
    in AD, with either the WinNT or LDAP providers. For example:

    Set objUser = GetObject("WinNT://MyDomain/JoeUser,user")
    or
    Set objUser = GetObject("LDAP://cn=Joe Smith,ou=Sales,dc=MyDomain,dc=com")

    You bind with WinNT using the NT name ("pre-Windows 2000 logon name"). LDAP
    requires the Distinguished Name. The telephoneNumber attribute is only
    exposed by LDAP. I believe this is also true of logonCount. I have never
    seen LastLogoff return a value.

    Or, the script could bind to a container object, filter on users, and
    enumerate the user objects, but your problem is most likely related to which
    provider (WinNT or LDAP) is used to bind (make a connection to AD).

    --
    Richard
    Microsoft MVP Scripting and ADSI
    Hilltop Lab web site - http://www.rlmueller.net
    --
    "Joseph_01" <Joseph01@discussions.microsoft.com> wrote in message
    news:85D02CE9-E5C0-4494-97FC-D5B227E62661@microsoft.com...
    > Hello, I could not find what you meant by bind in the script. I'd post the
    > script here but it's rather long. We are using the useraccount.vbs found
    in
    > the Windows 2000 resource kit pretty much verbatim except for the
    > telephone.number field that I am trying to get to work.
    >
    > We are on a Win2000 Advanced Server. :-)
    >
    > "Joe Richards [MVP]" wrote:
    >
    > > The line with the getobject in it where you connect to the directory.
    Are you,
    > > by any chance using WinNT://
    > >
    > > --
    > > Joe Richards Microsoft MVP Windows Server Directory Services
    > > www.joeware.net
    > >
    > >
    > > Joseph_01 wrote:
    > > > "Bind?" Please explain.
    > > >
    > > > The script I'm using is the useraccount.vbs script, and it works fine
    except
    > > > for the telephonenumber line.
    > > >
    > > > "Joe Richards [MVP]" wrote:
    > > >
    > > >
    > > >>I would suspect your script before I would suspect AD.
    > > >>
    > > >>What does your bind look like?
    > > >>
    > > >>--
    > > >>Joe Richards Microsoft MVP Windows Server Directory Services
    > > >>www.joeware.net
    > > >>
    > > >>
    > > >>Joseph_01 wrote:
    > > >>
    > > >>>Thank you for your reply. I still fail to get any output from str3
    in my
    > > >>>script when I insert it as follows:
    > > >>>
    > > >>>str1 = "Last Login: " & objUser.LastLogin
    > > >>>str2 = "Last Logoff: " & objUser.LastLogoff
    > > >>>str3 = "Phone: " & objUser.telephoneNumber
    > > >>>str4 = "Logon Count: " & objUser.logonCount
    > > >>>
    > > >>>When I run my script, str3 does not appear even though I have the
    telephone
    > > >>>number field filled in. Perhaps this is a bug in my AD?
    > > >>>
    > > >>>"Joe Richards [MVP]" wrote:
    > > >>>
    > > >>>
    > > >>>
    > > >>>>The AD attribute is telephoneNumber.
    > > >>>>
    > > >>>>--
    > > >>>>Joe Richards Microsoft MVP Windows Server Directory Services
    > > >>>>www.joeware.net
    > > >>>>
    > > >>>>
    > > >>>>Joseph_01 wrote:
    > > >>>>
    > > >>>>
    > > >>>>>I'm trying to create a vbs script that exports user information
    similar to
    > > >>>>>the lines below, but I would like to export the Telephone Number
    from the
    > > >>>>>General Tab of a user's properties in AD. Does anyone know what the
    & objUser
    > > >>>>>code is for the telephone number? I've searched the internet and
    tried many
    > > >>>>>different utilities (ADFIND, useraccount.vbs, listproperties.vbs)
    but I can't
    > > >>>>>find the field I require to output the telephone number.
    > > >>>>>
    > > >>>>>str1 = "Last Login: " & objUser.LastLogin
    > > >>>>>str2 = "Last Logoff: " & objUser.LastLogoff
    > > >>>>>str3 = "Phone: " & objUser.?????
    > > >>>>
    > >
Ask a new question

Read More

VBS Microsoft Active Directory Windows