|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
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 |
#2
| |||
| |||
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
__________________ The FIFA Manager 2009 PC Game |
#3
| |||
| |||
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.
__________________ Grand Theft Auto 4 PC Video Game |
#4
| |||
| |||
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 |
![]() |
|
Tags: ads, script, vbs |
Thread Tools | Search this Thread |
|
![]() | ||||
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 |