The Deployment Bunny

OS Deployment, Virtualization, Microsoft based Infrastructure…

  • Archives

  • Meta

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

Posted by Mikael Nystrom on December 19, 2013

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 Responses to “Nice to Know–Getting Make and Model using CMD or PowerShell”

  1. Mike said

    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

  2. Graeme said

    Another reason to move towards using PowerShell is that wmic was deprecated in Windows Server 2012.

    The WMI command-line tool (Wmic) is deprecated. Use PowerShell cmdlets instead.

    http://technet.microsoft.com/en-us/library/hh831568.aspx

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

Join 3,956 other followers

%d bloggers like this: