xwinterx Posted October 8, 2009 Posted October 8, 2009 (edited) I am using the following example to make a time-restricting app for my Win XP Home machine. So far it is working great, but I have a question. Is there a way to get the "type" of Windows User Account or something? When I run this code, stock, I get extra user accounts that I assume are "built-in". But I don't want those user accounts listed in my app. I just want to see my family's accounts. I know I could do it easy by just hard-coding the account names, but I don't want to. I'd like to make this app available to anyone and without the need of hard-coding, if that makes sense. #include <array.au3> ; Not needed by _ListUsers() $LU = _ListUsers() If Not @error Then _ArrayDisplay($LU, "List Users") Func _ListUsers() Local $colUsers, $sTmp, $Array[1] = ["user"] $colUsers = ObjGet("WinNT://" & @ComputerName) If Not IsObj($colUsers) Then Return SetError(1, 0, 0) $colUsers.Filter = $Array For $objUser In $colUsers $sTmp &= $objUser.Name & "|" Next Return SetError(0, 0, StringSplit(StringTrimRight($sTmp, 1), "|")) EndFunc Edited October 8, 2009 by xwinterx
xwinterx Posted October 8, 2009 Author Posted October 8, 2009 Nevermind... I tried this modded code and it works for me: #include <array.au3> ; Not needed by _ListUsers() $LU = _ListUsers() If Not @error Then _ArrayDisplay($LU, "List Users") Func _ListUsers() Local $colUsers, $sTmp, $Array[1] = ["user"] $colUsers = ObjGet("WinNT://" & @ComputerName) If Not IsObj($colUsers) Then Return SetError(1, 0, 0) $colUsers.Filter = $Array For $objUser In $colUsers If $objUser.Description = "" Then $sTmp &= $objUser.Name & "|" EndIf Next Return SetError(0, 0, StringSplit(StringTrimRight($sTmp, 1), "|")) EndFunc so it only lists my local accounts.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now