This article is another method for authentication. General method is simple username and password required authentication. This method may be additional your auth. method. Authorization is using for a role based security.

Required Equipments:

Another usb flash driver. (It’s damaged or secured, it can saw a “my computer” only.)


Analysis

We are get the usb flash drive PNPDeviceID, if my drive is needed drive than condition has true else false. Checking usb flash drive is another advantage for user: User use a another computer. (Same Rooming Profile for Server Operating System).

WMI (Windows Managment Interface) : WMI has created windows 2000 and later windows os. (Win NT Based OS). It’s get more information on running system and checking and managing litle system object. Any query with WQL for WMI. Windows Xp has approximate 900 WMI object. If you see wmi tester then click start menu and click run, write wbemtest and click Ok. For more information click here.
Example: “SELECT * From Win32_LogicalFileAccess”,
“SELECT * From Win32_LoggedOnUser” … like sql query:)

Writing Code

Create a new console project in visual studio 2005/2008
Open program.cs and paste following method

        private static bool ScanNeededDiskDriver(string PNPDeviceID)
        {
            Console.WriteLine("Starting query");
            ManagementObjectSearcher mOSClass = new ManagementObjectSearcher();
            mOSClass.Query = new ObjectQuery("SELECT * From Win32_DiskDrive");

            Console.WriteLine("\tSarching disk driver.");
            foreach (ManagementObject mOClass in mOSClass.Get())
            {
                if (mOClass["PNPDeviceID"].ToString() == PNPDeviceID)
                {
                    Console.WriteLine("\t\tSucces. Needed driver was found.");
                    return true;
                }
            }
            Console.WriteLine("\t\tNeeded disk driver can not be found.\r\n\t\tPlease insert another driver.");
            return false;
        }