?
Solved

Get current User, using ADSI

Posted on 2002-07-23
8
Medium Priority
?
621 Views
Last Modified: 2007-11-27
A simple question this one. All I need to do is to get the current NT user, using Active Directory Service.

0
Comment
Question by:GrahamAtJobserve
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 5

Expert Comment

by:RainUK
ID: 7171367
Do you wish to get the name of the user on the machine the app is running on or on another computer across the network?

Well below is simple code to get the local computer users name (Of course you could just use the Win32 API GetUserName)

Dim sys As New ADSystemInfo
Debug.print "User: " & sys.UserName
Debug.print "Computer: " & sys.ComputerName
Debug.print "Domain: " & sys.DomainDNSName
Debug.print "PDC Role Owner: " & sys.PDCRoleOwner
0
 

Author Comment

by:GrahamAtJobserve
ID: 7171375
I wish to get the name of the current user, on the machine the app is running on.

NOT using the API. I've got this function already, but trying to 'upgrade' to ADSI. The upgrade is seeming like a retrograde step at present. Its slower than before.

Tried the code - won't compile. What references does it need to run?
0
 

Author Comment

by:GrahamAtJobserve
ID: 7171387
I have the references, I think. I'm getting the intellisense functions appear, and its in the object browser, but getting the '429 - activex component cant create object' messgae
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 5

Expert Comment

by:RainUK
ID: 7171422
Have you selected the reference: Active DS Type Library?
Should be in C:\WinNT\System32\activeds.tlb

When you run the app is it on a dev machine? or a prod machine. Because if you don;t install the activeds.tlb on the client, then you will get the ActiveX 429 error

0
 

Author Comment

by:GrahamAtJobserve
ID: 7171430
Yes, its selected, and working on my own PC in dev. I'm getting other ADSI functions to work, eg lists of groups, users etc,  I just can't get who the current user is.


0
 
LVL 5

Expert Comment

by:RainUK
ID: 7171441
Are you running version 2.5 of ADSI?
Also what is your dev machine and the client OS?

If client is NT4 try this:

Dim ntsys As New WinNTSystemInfo
Debug.print "User: " & ntsys.UserName
Debug.print "Computer: " & ntsys.ComputerName
Debug.print "Domain: " & ntsys.DomainName
Debug.print "PDC: " & ntsys.PDC


But ActiveX 429 is usually the fact that you do not have the correct COM object int his case the Activeds.tlb on the computer.
0
 
LVL 5

Accepted Solution

by:
RainUK earned 400 total points
ID: 7171442
Are you running version 2.5 of ADSI?
Also what is your dev machine and the client OS?

If client is NT4 try this:

Dim ntsys As New WinNTSystemInfo
Debug.print "User: " & ntsys.UserName
Debug.print "Computer: " & ntsys.ComputerName
Debug.print "Domain: " & ntsys.DomainName
Debug.print "PDC: " & ntsys.PDC


But ActiveX 429 is usually the fact that you do not have the correct COM object int his case the Activeds.tlb on the computer.
0
 

Author Comment

by:GrahamAtJobserve
ID: 7171454
Thats perfect, exactly what I needed.

Thaknk you.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month9 days, 2 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question