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
  1. Home
  2. General Programming
  3. Visual Basic
  4. operating system accounts(to login) in vb.net

operating system accounts(to login) in vb.net

Scheduled Pinned Locked Moved Visual Basic
csharpdatabase
2 Posts 2 Posters 3 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
    amaneet
    wrote on last edited by
    #1

    I am using the following code to list the accounts of my operating system. Currently i have just two accounts namely 1.Administator 2.Guest But it shows 6 accounts. can i filter the query to make it to show the actual accounts. Dim oQuery As New Management.ObjectQuery("select * from Win32_Account WHERE SIDType = 1") Dim osearch As New ManagementObjectSearcher(oQuery) Dim ocollection As ManagementObjectCollection = osearch.Get Dim oresult As ManagementObject For Each oresult In ocollection TextBox1.Text = oresult("Name").ToString & " " Next Thank You Pankaj

    L 1 Reply Last reply
    0
    • A amaneet

      I am using the following code to list the accounts of my operating system. Currently i have just two accounts namely 1.Administator 2.Guest But it shows 6 accounts. can i filter the query to make it to show the actual accounts. Dim oQuery As New Management.ObjectQuery("select * from Win32_Account WHERE SIDType = 1") Dim osearch As New ManagementObjectSearcher(oQuery) Dim ocollection As ManagementObjectCollection = osearch.Get Dim oresult As ManagementObject For Each oresult In ocollection TextBox1.Text = oresult("Name").ToString & " " Next Thank You Pankaj

      L Offline
      L Offline
      lucjon
      wrote on last edited by
      #2

      I think it is showing the real accounts, with the `hidden` accounts, such as the help and support account, if you have VMWare installed, __vmware_user__ and other things. You could try:

      For Each oresult In ocollection
      Dim oname As String = oresult("Name").ToString
      If Not oname.StartsWith("SUPPORT") Then
      If oname <> "__vmware_user__" Then
      If oname <> "ASPNET" Then
      If oname <> "HelpAssistant" Then
      textBox1.Text = oname & " "
      End If
      End If
      End If
      End If

      I don't know if this'll work very well.

      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