Retrieving model-specific data of HDDs in Software Produce Code-39 in Software Retrieving model-specific data of HDDs

How to generate, print barcode using .NET, Java sdk library control with example project source code free download:
8. generate, create code 39 full ascii none for software projects iPad Retrieving model-specific data of HDDs Our instincts said that we could throw together an easy WSH VB script, based on the appropriate WMIs; we could retrieve and echo the model-specific data we were looking for. However, the results were not so promising. Therefore, we looked further.

. WMI stands for Windows Man Software barcode 39 agement Instrumentation. It is a set of extensions to the Windows Driver Model (WDM), and provides an interface to the operating system through which instrumented components provide information and notification. In our case, WMI allows us to work with scripting languages and query hardware-specific information directly.

. Fortunately, we found the CodeProject article Get Physical HDD Serial Number without WMI at

aspx. The author of the source code and article, Decebal Mihailescu, explains quite thoroughly how to use the code. We can use any .

NET language (at least 2.0 Framework). The code he posted returns all of the model-specific data within a collection.

The way we organize and deal with the rest is up to us. We can format the output and pick the ones we want. Therefore, we do not have to deal with the inner-workings of the application.

We just implement the collection it returns when we retrieve the data. Even though the level of the project is quite advanced, the implementation part does not require higher than an intermediate level of programming. We opted for C Sharp (C#) programming language.

Once the project is compiled, we will get our .exe and the .dll files.

The dynamic link library contains the unmanaged code with which we are going to work. It is not necessary for us to understand how it works on the algorithmic level. It does low-level calls to the hard drive via DeviceIoControl API.

The code is object oriented and that"s why building on top of the foundation is rather easy, as one function fills up the collection. Now that we are throwing together an application like this, we need to look ahead and think out of the box. As we"re going to remotely execute this tiny program across every machine of the domain, the output will be logged in a text file.

In order to ease the logging and searching, it would be awesome to retrieve the name of the computer and IP address. Print these out along with the model-specific information. Then put some delimiters.

. [ 201 ]. Best Practices on Inventorying with OCS-NG Check out the next screens Software barcode 3 of 9 hot. This is a snippet of the output log of the application that we have put together in less than 30 minutes based on that CodeProject publication..

Here is a quick implementa tion of the things we mentioned. Things might seem a bit complex at first. The source code is rather simple, but if you don"t have C# experience, then this part of the chapter might have caught you off-guard.

Either way, we will supply the source code of this project along with a ready-to-run executable.. DriveListEx m_list; m_list bar code 39 for None = new DriveListEx(); m_list.Load(); string currUser = System.Security.

Principal.WindowsIdentity. GetCurrent().

Name.ToString(); string currComp = Environment.MachineName; IPHostEntry ipEntry = Dns.

GetHostEntry(currComp); IPAddress[] addr = ipEntry.AddressList; Console.WriteLine("Running the script on the following machine: {0} @ {1}", currUser, currComp); Console.

WriteLine("IP Address of the machine: {0}", addr[0]. ToString()); Console.WriteLine(" "); Console.

WriteLine("Querying Hard Disk Drive Information...

"); Console.WriteLine(" "); Thread.Sleep(500); // sleep to ensure querying finishes.

[ 202 ]. 8 if (m_list.Count < 1 barcode 3 of 9 for None ) { // nothing to do if there are no disk drives detected Console.WriteLine("Could not find any disk drive attached to the system.

"); Console.WriteLine("Nothing left to do. Done.

"); } Console.WriteLine("Found {0} disk drive(s) in the system.", m_list.

Count); Console.WriteLine(" "); for (int i = 0; i < m_list.Count; i++) { Console.

WriteLine("Information of the disk drive number {0} [{1}]", i+1, currComp); Console.WriteLine("-------------------------------------"); Console.WriteLine("Entire size: {0} bytes, meaning {1} GB",m_list[i].

DriveSize/10,m_list[i].DriveSize/1000000000); Console.WriteLine("Buffer size: {0} bytes, meaning {1} MB",m_list[i].

BufferSize,m_list[i].BufferSize/1000000); Console.WriteLine("Model no:{0}",m_list[i].

ModelNumber); Console.WriteLine("Drive type: {0}",m_list[i].DriveType); Console.

WriteLine("Firmware:{0}",m_list[i].RevisionNumber); Console.WriteLine("Serial number: {0}\n",m_list[i].

SerialNumber); } Console.WriteLine("Successful execution on {0} [{1}]. Done.

", currComp, addr[0].ToString());. You can find the implement ation of this project at the following URL:.
Copyright © . All rights reserved.