Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 06-04-2009
Member
 
Join Date: Feb 2009
Posts: 27
Vbs Script to Retrieve Name of Ads User

Hello,

I am trying to make a vbs script which gives me the first and last name of my AD User that runs the scripts Here is a part of the code:

Code:
Select All 
Set Root = GetObject("LDAP://RootDSE") 
DomainPath = Root.Get("DefaultNamingContext") 
Set Domain = GetObject("LDAP://" & DomainPath) 
Set objUse = GetObject("LDAP://OU=OU-Utilisateurs," & DomainPath) 
WScript.Echo "First Name: " & objUse.givenName
But when I run It nothing happens, I have full test without ever seeing the name or surname , In my OU Users OU-I "sub" or "style of Students, Teachers, Admin please Give me Proper Suggestions and Code that you might Have use to Achieve the Following results.
Reply With Quote
  #2  
Old 06-04-2009
Member
 
Join Date: May 2008
Posts: 2,383
Re: Vbs Script to Retrieve Name of Ads User

Hello , You Can Checkout the Following

Code:
Set objWMISvc = GetObject( "winmgmts:\\.\root\cimv2" )
Set colItems = objWMISvc.ExecQuery( "Select * from Win32_ComputerSystem", , 48 )
For Each objItem in colItems
    strUserName = objItem.UserName
    WScript.Echo "User Name: " & strUserName
Next
it Might Help You
__________________
The FIFA Manager 2009 PC Game
Reply With Quote
  #3  
Old 06-04-2009
Member
 
Join Date: Oct 2005
Posts: 2,389
Re: Vbs Script to Retrieve Name of Ads User

Hello , You Can the command "net user", it Will tell you the Same Things .You can use the net user command to create and modify user accounts on omputers. When you use this command without command-line switches, the user accounts for the computer are listed. The user account information is stored in the user accounts database. This command works only on servers.
Reply With Quote
  #4  
Old 06-04-2009
Member
 
Join Date: Nov 2005
Posts: 1,323
Re: Vbs Script to Retrieve Name of Ads User

Hello , You might want to Check these Code also if it help you


Code:
Public Function UserName() As String
    On Error Resume Next
    Dim oSysInfo As New ActiveDs.WinNTSystemInfo
    UserName = oSysInfo.UserName
    Set oSysInfo = Nothing
End Function
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Vbs Script to Retrieve Name of Ads User"
Thread Thread Starter Forum Replies Last Post
Script to change User Profile paths gram Windows Server Help 4 10-05-2010 11:37 PM
Script that allows me to Switch User The Recruiter Software Development 6 05-01-2010 10:39 PM
Selecting a user in a shell script Quattro Operating Systems 5 25-12-2009 02:11 PM
Script to Update user attributes in AD Fahad Active Directory 3 29-05-2009 02:44 AM
VB script - List all user groups Help Daljeet Software Development 4 18-12-2008 07:51 PM


All times are GMT +5.5. The time now is 04:59 AM.