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. C#
  4. Retrieve windows users list

Retrieve windows users list

Scheduled Pinned Locked Moved C#
asp-net
3 Posts 2 Posters 1 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.
  • A Offline
    A Offline
    Alper Camel
    wrote on last edited by
    #1

    Greetings all, I'd like to retrieve all windows users, actually the user list when the xp os starts, the user list seen in the screen. I mean I dont want to list the hidden users like; ASPNET, HelpAssistant, SQLDebugger ... I just want to gather a list that user who logon. like, John, Mary, ... I currently user tthe following code, but it retrieve all users, inculding hidden ones. //-------------------------------------------------------------------------------- DataTable dtKullanicilar = new DataTable(); DataColumn dcAd = new DataColumn("Kullanici", typeof(string)); dtKullanicilar.Columns.Add(dcAd); ManagementClass usersClass = new ManagementClass("Win32_UserAccount"); ManagementObjectCollection users = usersClass.GetInstances(); foreach (ManagementObject user in users) { DataRow dru = dtKullanicilar.NewRow(); dru["Kullanici"] = Convert.ToString(user["Name"]); dtKullanicilar.Rows.Add(dru); } //-------------------------------------------------------------------------------- Thank you all ...

    N 1 Reply Last reply
    0
    • A Alper Camel

      Greetings all, I'd like to retrieve all windows users, actually the user list when the xp os starts, the user list seen in the screen. I mean I dont want to list the hidden users like; ASPNET, HelpAssistant, SQLDebugger ... I just want to gather a list that user who logon. like, John, Mary, ... I currently user tthe following code, but it retrieve all users, inculding hidden ones. //-------------------------------------------------------------------------------- DataTable dtKullanicilar = new DataTable(); DataColumn dcAd = new DataColumn("Kullanici", typeof(string)); dtKullanicilar.Columns.Add(dcAd); ManagementClass usersClass = new ManagementClass("Win32_UserAccount"); ManagementObjectCollection users = usersClass.GetInstances(); foreach (ManagementObject user in users) { DataRow dru = dtKullanicilar.NewRow(); dru["Kullanici"] = Convert.ToString(user["Name"]); dtKullanicilar.Rows.Add(dru); } //-------------------------------------------------------------------------------- Thank you all ...

      N Offline
      N Offline
      Niiiissssshhhhhuuuuu
      wrote on last edited by
      #2

      Hi, Hey do this man!!!! Environment.OSVersion.Platform Environment.UserName This will help you!!!! :cool::cool: nishu

      A 1 Reply Last reply
      0
      • N Niiiissssshhhhhuuuuu

        Hi, Hey do this man!!!! Environment.OSVersion.Platform Environment.UserName This will help you!!!! :cool::cool: nishu

        A Offline
        A Offline
        Alper Camel
        wrote on last edited by
        #3

        Thank you, but I want to retireeve all users, not the current user :(

        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