How to get full name of logon user? 
Author Message
 How to get full name of logon user?

I am trying to write a script which has to display the full name (not user
ID) of the logon user.  It might be in the registry but I don't seem to be
able to find it.  Can anyone give me some hints?

Thanks in advance.

Joe



Mon, 16 May 2005 11:42:02 GMT  
 How to get full name of logon user?
Would you like their social and financials with that?

dlbjr

Innumerable ascent nobler than others,
before realizing it's the wrong impediment.



Mon, 16 May 2005 12:35:07 GMT  
 How to get full name of logon user?

Quote:

> I am trying to write a script which has to display the full name (not user
> ID) of the logon user.  It might be in the registry but I don't seem to be
> able to find it.  Can anyone give me some hints?

Hi

It is not in registry.

What kind of network does the user log into, NT 4.0 domain, AD or something
else?

What OS on the clients?

--
torgeir
Microsoft MVP Scripting and WMI
Porsgrunn Norway



Mon, 16 May 2005 12:43:24 GMT  
 How to get full name of logon user?


Quote:
> Would you like their social and financials with that?

> dlbjr

or just their credit card numbers?


Mon, 16 May 2005 16:47:50 GMT  
 How to get full name of logon user?
Users log on to the AD with their Windows 2000.  I can get their username by
using the %username% variable.  But the environment variables do not include
their descriptive names.



Quote:

> > I am trying to write a script which has to display the full name (not
user
> > ID) of the logon user.  It might be in the registry but I don't seem to
be
> > able to find it.  Can anyone give me some hints?

> Hi

> It is not in registry.

> What kind of network does the user log into, NT 4.0 domain, AD or
something
> else?

> What OS on the clients?

> --
> torgeir
> Microsoft MVP Scripting and WMI
> Porsgrunn Norway



Mon, 16 May 2005 20:49:12 GMT  
 How to get full name of logon user?

Quote:

> Users log on to the AD with their Windows 2000.  I can get their username by
> using the %username% variable.  But the environment variables do not include
> their descriptive names.

Hi

Set oADsRootDSE = GetObject("LDAP://RootDSE")
On Error Resume Next
Set oADsSysInfo = CreateObject("ADSystemInfo")

If Err.Number <> 0 Then
 MsgBox "Problem accessing ADSystemInfo, aborting!" & vbCrLf & vbCrLf _
  & "Error #: 0x" & Hex(Err.Number) & vbCrLf _
  & "Error description: " & Err.Description
 WScript.Quit
End If
Err.Clear

' Get distinguished name of the current user
sADsUser = oADsSysInfo.UserName
If Err.Number <> 0 Then
 MsgBox "Problem reading user data from AD, aborting!" & vbCrLf & vbCrLf _
   & "Error #: 0x" & Hex(Err.Number) & vbCrLf _
   & "Error description: " & Err.Description
 WScript.Quit
End If
Err.Clear

On Error Goto 0

' Get user object
sUserPath = "LDAP://" & sADsUser
Set oADsContainer = GetObject(sUserPath)

' Get full name of the current user
sUserNameFull = oADsContainer.DisplayName

MsgBox "FullName: " & sUserNameFull

--
torgeir
Microsoft MVP Scripting and WMI
Porsgrunn Norway



Mon, 16 May 2005 23:32:27 GMT  
 How to get full name of logon user?
Work like a chime.  I have also tried your code in the other post that you
responded to another user.  That one gives the logon name.

Thanks.

Joe



Quote:

> > Users log on to the AD with their Windows 2000.  I can get their
username by
> > using the %username% variable.  But the environment variables do not
include
> > their descriptive names.

> Hi

> Set oADsRootDSE = GetObject("LDAP://RootDSE")
> On Error Resume Next
> Set oADsSysInfo = CreateObject("ADSystemInfo")

> If Err.Number <> 0 Then
>  MsgBox "Problem accessing ADSystemInfo, aborting!" & vbCrLf & vbCrLf _
>   & "Error #: 0x" & Hex(Err.Number) & vbCrLf _
>   & "Error description: " & Err.Description
>  WScript.Quit
> End If
> Err.Clear

> ' Get distinguished name of the current user
> sADsUser = oADsSysInfo.UserName
> If Err.Number <> 0 Then
>  MsgBox "Problem reading user data from AD, aborting!" & vbCrLf & vbCrLf _
>    & "Error #: 0x" & Hex(Err.Number) & vbCrLf _
>    & "Error description: " & Err.Description
>  WScript.Quit
> End If
> Err.Clear

> On Error Goto 0

> ' Get user object
> sUserPath = "LDAP://" & sADsUser
> Set oADsContainer = GetObject(sUserPath)

> ' Get full name of the current user
> sUserNameFull = oADsContainer.DisplayName

> MsgBox "FullName: " & sUserNameFull

> --
> torgeir
> Microsoft MVP Scripting and WMI
> Porsgrunn Norway



Tue, 17 May 2005 10:42:13 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Getting the user's logon name and computer name

2. Getting WinNT logon names and user groups

3. Getting the user full name from SAM.

4. Getting The Full Domain User Name In Win95

5. Getting user name during NT logon

6. Getting the full user name under Win NT

7. Getting full list of Domain Users is not working properly - some users missing

8. Getting full list of Domain Users is not working properly - some users missing

9. Getting full path name

10. Full User Name

11. Full user name from NT login ID

12. Users full name i login script

 

 
Powered by phpBB® Forum Software