开发者

Windows 7: How can I get a list of all Windows user names in .Net?

开发者 https://www.devze.com 2022-12-20 13:57 出处:网络
Is there a simple way to get the names of all the user names of a local Windows 7 machine using .Net? So if I had a machine named MyPC, and it had 3 users MyPC\\Mike, MyPC\\Bob, and MyPC\\Steve, I\'d

Is there a simple way to get the names of all the user names of a local Windows 7 machine using .Net? So if I had a machine named MyPC, and it had 3 users MyPC\Mike, MyPC\Bob, and MyPC\Steve, I'd just want to be able to query to get Mike, Bob, and Steve. Of course, I don't care if they have the compu开发者_如何学运维ter name attached, or not, as well.


If no-one comes up with a better way, you could enumerate the \Users folder and use the folders in there as representations. (Providing each user has logged in and the network isn't using roaming profiles)


http://www.codeproject.com/KB/cs/enumerate_system_users.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消