Deployment

Nice to Know–Getting Make and Model using CMD or PowerShell

Trust me, this is not a new thing, rather I get the question every time on a session (before or after) or when working on a customer site, how can I extract the Make and Model from the machine? So, as long as people are asking me, I think I should answer, right? :-)

Make and Model is commonly used in deployment solutions to figure out what drivers that needs to download to each machine during install. It is a part of the SMBBios information and can be accessed using WMI, in WMIC it is called Name and Vendor and in PowerShell it is called Manufacturer and Model. Now, lets take a look.

The Old WMI Method:

Execute wmic csproduct get name,vendor from a CMD prompt.

image

The New POSH Method:

Execute Get-WmiObject Win32_ComputerSystem | Select Model,Manufacturer from a PowerShell prompt.

image

/mike

4 replies »

  1. I am trying to understand why is it better? I need to type more and i need to remember a wmi class? Getting same information?

    • Never told you it was better :-)
      But, first of all, PowerShell is a script language and therefore the values you get back is objects that could be used as conditions and so on, you could basically build anything you like, and you can automate it. Trying the same thing with wmic.exe is not really doable.
      Second, since it is PowerShell that also means you could type things differently, meaning shorter, so it is also possible to type “gwmi win32_computersystem” to get the same information, just in another form.
      Yes, you do need to remember WIN32 classes, but that’s like everything else you need to remember

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.