Jitesh Byahut 2/16/2014 2782

Win32_UserAccount in WMI C# Asp.Net

Here we are retrieving user accounts details of Computer.

Use namespace System.Management

ManagementObjectSearcher objaccount = new ManagementObjectSearcher("select * from Win32_UserAccount");

 

        foreach (ManagementObject obj in objaccount.Get())

        {

            Response.Write("Name     -   " + obj["Name"]+"</br>");

            Response.Write("AccountType - " + obj["AccountType"] + "</br>");

            Response.Write("Disabled   -  " + obj["Disabled"] + "</br>");

            Response.Write("Lockout  -    " + obj["Lockout"] + "</br>");

            Response.Write("PasswordChangeable - " + obj["PasswordChangeable"] + "</br>");

            Response.Write("PasswordExpires - " + obj["PasswordExpires"] + "</br>");

            Response.Write("PasswordRequired - " + obj["PasswordRequired"] + "</br>");

            Response.Write("SIDType    -       " + obj["SIDType"]+"</br></br>");

        }  

Demo

View output :

demoimage


Please give your feedback for improving this page