Computer Name/UserName

MUKESHY12390

Well-known Member
Joined
Sep 18, 2012
Messages
901
Office Version
  1. 2013
  2. 2011
  3. 2010
  4. 2007
Platform
  1. Windows
Hi All,

I have list of "Computer Name", is there any method I can get "UserName" from it.

I get all this "Computer Name" through running below code. I'm trying to get userName while having below macro running OR after this process.

Any direct or indirect help would be appreciate.



Code:
Public Sub Current_UserList_MSAccess(oConn As ADODB.Connection)
  Dim rs As ADODB.Recordset
      Set rs = oConn.OpenSchema(adSchemaProviderSpecific, , _
          "{947bb102-5d43-11d1-bdbf-00c04fb92675}")
          
Debug.Print rs.Fields(0).Name, "", rs.Fields(1).Name, rs.Fields(2).Name, rs.Fields(3).Name
    
Do Until rs.EOF
 
  If Not (rs.BOF And rs.EOF) Then
  '  Debug.Print rs.GetString
      Debug.Print rs.Fields(0), rs.Fields(1), rs.Fields(2), rs.Fields(3)
  End If
  rs.MoveNext
Loop
      rs.Close
  End Sub


Sub test()
  Call Current_UserList_MSAccess(CurrentProject.Connection)
End Sub


thanks,
Mukesh Y
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
the output would be same ....but this is not method just provides "UserName" not against the computerName
 
Upvote 0

Forum statistics

Threads
1,221,798
Messages
6,162,027
Members
451,737
Latest member
MRASHLEY

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top