...Because someone's gotta tell the story...


To return to the main Blog List, click Full Blog Listing.


Domain Controller

Identifying a Workstation vs. Server since Windows 8

Monday, April 28, 2014 in Technical Articles (Views: 2238)
So, a quickie - but something that may be of use to those of you enterprise level admins:

It used to be that Win32_OperatingSystem, and more specifically Name was all you needed to pick up whether an OS was Server or Workstation, simply by the words Server and Workstation in them.

With Server 2012, the word Enterprise was removed from the Name, for Datacenter, good, but...
Windows Serer 2008 and R2 Enterprise are vastly different from Windows 8.1 Enterprise, so it's hard to just depend on the name.

Enter ProductType. By using this query, you can determine Server or Workstation a little easier.. Here are the values:
1: Workstation
2: Domain Controlle
3: Server

So, simply put, a WMI call for select producttype from win32_operatingsystem where producttype='1' will find a Workstation class OS

select producttype from win32_operatingsystem where producttype='2' or producttype='3'
will return all servers, including domain controllers.

Of course, if you want to omit Domain Controllers, just remove the producttype='2' piece.

Happy WMI scripting...


Related Blogs You May Be Interested In:

To leave a comment, please log in and/or register.