[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Get current User, using ADSI

Posted on 2002-07-23
8
Medium Priority
?
625 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

649 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