Getting detailed Information about Windows User Accounts with WMI and C#

This article is aimed about how to get detailed information about Windows user accounts like accounts SID, SID type, Name, caption, Account domain and whether Account Status is OK, degraded unknown etc through  WMI.


To access account information of windows users we need to Use System.Management  name space.


To use this namespace first of all we need to add reference to System.management by


Project Menu>>Add Reference.


after that at the top of the code use


using System.Management; so that you can use of its classes .


Now its simple to get information about any Windows user Account through querying ManagementObjectSearcher Class .


we can get all information about Windows User through Win32_Account class .


so we need to query on that class to get related Management object and then we just need to get various properties related to it .


View the original article here