Microsoft has wonderfull products, and Windows Server 2003 and Windows 2008(R2) are fine examples of it. In this article the solution is a wmic.exe command which can be executed also on normal workstations with Windows XP pro, Vista, Windows 7 and even on Windows 8! These letters are short for "Windows Management Instrumentation Command" but now everyone is calling it just WMI. A lot of people are not familiar with the WMI commands, but a lot of programs are using it "underwater". The scripting guys among us, will know it for sure. This command can retrieve almost any data from a machine, bios or software, as a separate process, it just needs to be available somewhere, and you should know where and how to find it! The WMI APP's have been introduced a long, long time ago, but haven't had the attention from programmers and developers until lately. Now today I needed to retrieve the Model number and the Serial number from a machine which I can access through a RDP session. Lets just say our CMDB missed some data,...  But this is good for you, as I decided to share that information with you all. I will post some more articles on some other wmic commands later this week.


Now, how do you get the Model and Serial number from the (remote) machine?

First of all you need to open an (elevated) command prompt on the machine it concerns.
I guess I do not have to explain how you do that, I suppose,...
You can play around whatever you want with wmic as long as you use the "get" command.
Just like todays powershell, is does not change anything, just retrieves data and will not harm your system in any way.

You can directly start typing the following commands:

wmic csproduct get vendor,name
This is the command to retrieve the type and Vendor and modelnumber from the machines hardware.

wmic bios get serialnumber
This is the command to get the serial number out of the machines BIOS.

I put a picture of these commands right down this line.

wmic command to retrieve vendor, model and serial number from your windows machine www.oostdam.info












Some additional information. It is possible that you get a small line on your screen,
when you've never used wmic before which says: "Wait while wmic is being installed." Do not worry, this is normal,
can do no harm to your system and it will disappaer on executing your commandline.

You can outline and export your data to a file also. Please be aware, that the /translate statement must follow the /format option, but if you really want to get deeper in al this stuff... Go search Microsoft Technet or Google it. There is a lot of example stuff out there. It depends a lot on the WMI version and the OS your running the command on. The format option has multiple stylesheets but the syntax can differ between XP and Windows 7 systems for instance. Do you need just a few numbers? Perhaps your screen is enough, write it down!

Hope this information helped you on the way, and as promised above, I will publish some more articles with wmic commands somewhere next week.


-------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Ben OostdamBen Oostdam has been working with Windows systems since 1993. Worked for several companies as a system administrator, and is currently a Senior Support Engineer for a large company located in the Netherlands.

Disclaimer: The information contained in this website/article is for general information purposes only. The information is provided as is, by Ben Oostdam and while we endeavour to keep the information up to date and correct, we make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the website or the information, products, services, or related graphics contained on the website for any purpose. Any reliance you place on such information is therefore strictly at your own risk. In no event will we be liable for any loss or damage including without limitation, indirect or consequential loss or damage, or any loss or damage whatsoever arising from loss of data or profits arising out of, or in connection with, the use of this website. Through this website you are sometimes able to link to other websites which are not under my control. I have no control over the nature, content and availability of those sites. The inclusion of any links does not necessarily imply a recommendation or endorse the views expressed within them. Every effort is made to keep the website up and running smoothly. However, I take no responsibility for, and will not be liable for, the website being temporarily unavailable due to technical issues beyond our control. All entries in these articles, are my individual opinion, or from co-writers and they don't necessary reflect the opinion of my employer.




 

Wednesday the 17th, July 2019. All rights reserved.. // Oostdam WebDesign