Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. getting complete name of account NT server

getting complete name of account NT server

Scheduled Pinned Locked Moved Visual Basic
sysadminquestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sal21
    wrote on last edited by
    #1

    I know the name of Domain on NT platform "MY_Domain_name". I know the username "OU458778". Is possibile to know the complete name of username???? With vb6, please.

    S 1 Reply Last reply
    0
    • S sal21

      I know the name of Domain on NT platform "MY_Domain_name". I know the username "OU458778". Is possibile to know the complete name of username???? With vb6, please.

      S Offline
      S Offline
      Stinebaugh
      wrote on last edited by
      #2

      What do you mean by complete name? Like My_Domain_name\OU458778 or just the user's name like John Smith?

      S 1 Reply Last reply
      0
      • S Stinebaugh

        What do you mean by complete name? Like My_Domain_name\OU458778 or just the user's name like John Smith?

        S Offline
        S Offline
        sal21
        wrote on last edited by
        #3

        yes! just the user's name like John Smith

        S 1 Reply Last reply
        0
        • S sal21

          yes! just the user's name like John Smith

          S Offline
          S Offline
          Stinebaugh
          wrote on last edited by
          #4

          I don't have a copy of VB6 to test this with, but this VBScript code should translate pretty closely. You just need to do a WMI query against the Win32_UserAccount class. Name is the User ID and FullName should be the formatted name.

          strUserID = InputBox("Please enter the User ID you wish to find")

          strComputer = "."
          Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

          Set objAccountColl = objWMIService.ExecQuery("Select * from Win32_UserAccount where Name = '" & strUserID & "'")

          For Each objAccount in ObjAccountColl

          strValue = "AccountType: " & objAccount.AccountType & vbCrLf & _
          "Caption: " & objAccount.Caption & vbCrLf & _
          "Description: " & objAccount.Description & vbCrLf & _
          "Disabled: " & objAccount.Disabled & vbCrLf & _
          "Domain: " & objAccount.Domain & vbCrLf & _
          "FullName: " & objAccount.FullName & vbCrLf & _
          "InstallDate: " & objAccount.InstallDate & vbCrLf & _
          "LocalAccount: " & objAccount.LocalAccount & vbCrLf & _
          "Lockout: " & objAccount.Lockout & vbCrLf & _
          "Name: " & objAccount.Name & vbCrLf & _
          "PasswordChangeable: " & objAccount.PasswordChangeable & vbCrLf & _
          "PasswordExpires: " & objAccount.PasswordExpires & vbCrLf & _
          "PasswordRequired: " & objAccount.PasswordRequired & vbCrLf & _
          "SID: " & objAccount.SID & vbCrLf & _
          "SIDType: " & objAccount.SIDType & vbCrLf & _
          "Status: " & objAccount.Status
          MsgBox strValue
          Exit For
          Next

          S 1 Reply Last reply
          0
          • S Stinebaugh

            I don't have a copy of VB6 to test this with, but this VBScript code should translate pretty closely. You just need to do a WMI query against the Win32_UserAccount class. Name is the User ID and FullName should be the formatted name.

            strUserID = InputBox("Please enter the User ID you wish to find")

            strComputer = "."
            Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

            Set objAccountColl = objWMIService.ExecQuery("Select * from Win32_UserAccount where Name = '" & strUserID & "'")

            For Each objAccount in ObjAccountColl

            strValue = "AccountType: " & objAccount.AccountType & vbCrLf & _
            "Caption: " & objAccount.Caption & vbCrLf & _
            "Description: " & objAccount.Description & vbCrLf & _
            "Disabled: " & objAccount.Disabled & vbCrLf & _
            "Domain: " & objAccount.Domain & vbCrLf & _
            "FullName: " & objAccount.FullName & vbCrLf & _
            "InstallDate: " & objAccount.InstallDate & vbCrLf & _
            "LocalAccount: " & objAccount.LocalAccount & vbCrLf & _
            "Lockout: " & objAccount.Lockout & vbCrLf & _
            "Name: " & objAccount.Name & vbCrLf & _
            "PasswordChangeable: " & objAccount.PasswordChangeable & vbCrLf & _
            "PasswordExpires: " & objAccount.PasswordExpires & vbCrLf & _
            "PasswordRequired: " & objAccount.PasswordRequired & vbCrLf & _
            "SID: " & objAccount.SID & vbCrLf & _
            "SIDType: " & objAccount.SIDType & vbCrLf & _
            "Status: " & objAccount.Status
            MsgBox strValue
            Exit For
            Next

            S Offline
            S Offline
            sal21
            wrote on last edited by
            #5

            ok tks for reply... But i dont see where i insert the name of domain? :( :sigh:

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups