In VB.NET, how can you get a list of all users in the existing Windows machine?
You can use the registry for which a little parsing is required, but O works here Some code is:
C #
Registry user key = Registry. OpenSubby (@ "Software \ Microsoft \ Windows NT \ CurrentVersion \ ProfileList"); {String userpath = (string) key.GetValue ("ProfileImagePath") by using string keyname userskey.GetSubKeyNames ()) {(registry key key = userskey.OpenSubKey (keyname)); String Username = System.IO.Path.GetFileNameWithoutExtension (userpath); Console.light line ("{0}", user name); }} RegistryKey = Registry.LocalMachine.OpenSubKey ("Software \ Microsoft \ Windows \" NT \ Use the key as string in userskey.GetSubKeyNames () as each keyname RegistryKey = userskey.OpenSubKey (keyname) String = Direct Seit (key.GetValue ("ProfileImagePath"), string as the userpath) Slow user name string = System.IO.Path.GetFileNameWithoutExtension (userpath) Console.WriteLine ("{0}", user name) Next Use
Comments
Post a Comment