Query machine name and organization from SQL?

Hi,

I need to get the machine name and match it to the records in the v_GS_Operating_System_Data table if possible? So I would have the computer name and match it to the "organization0" column? Is this possible? Or is there a simpler way to query the machine name and the manufacturer listed in system properties without creating a mof file? I would like to use the already existing data in SQL. TIA

May 26th, 2015 3:13pm

Have you looked at the existing built-in reports? Have you tried to modify them?
Free Windows Admin Tool Kit Click here and download it now
May 26th, 2015 3:24pm

Yes but not finding what I need unfortunately so I thought there was quick way to get the machine name and manufacturer listed in system properties.
May 26th, 2015 3:31pm

something like...

select
  s.Netbios_Name0,
  os.Organization0,
  csys.Manufacturer0,
  csys.Model0
From v_r_system_valid s
  join v_gs_operating_system os on os.resourceid=s.resourceid
  join v_gs_computer_system csys on csys.resourceid=s.resourceid

Not sure if that's what you actually wanted.  When you said "manufacturer", that's actually in lots of different views.  Manufacturer of the OS, Manufacturer of the computer, Manufacturer of the keyboard... etc. etc.  I'm "guessing" you meant of the computer.  But it's just a guess.  if you mean something else, you'll have to clarify.

Free Windows Admin Tool Kit Click here and download it now
May 26th, 2015 4:14pm

Thank you, I think this is what I need. Basically when you go to system properties and next to manufacturer we have our company name so I am not sure where that is stored. But to clarify, what is Organization0? Is there an explanation of how this column is populated?
May 26th, 2015 4:21pm

ah, see, I just presumed you already *knew* that in v_gs_operatingsystem.organization0, that it contained exactly what you were looking for.

So, v_gs_operatingsystem comes from each client, their wmi, in win32_operatingsystem, *if*

  a) that what you actually CARE about is the Organization which created that particular Operating System, which according to this: https://msdn.microsoft.com/en-us/library/aa394239%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396, 99.999% of the time will likely say "Microsoft Corporation".  Unless you have a super-unique Operating System other than Microsoft's which also happens to have WMI, and a win32_operatingsystem namespace and that field is populated (unlikely, but hey, you might be one of the super unique out there)

 b) in your Hardware Inventory, Default Client Settings, for "what to report", you've checked the box in operatingsystem.organization.

Since I suspect that a) you don't actually care. and b) even if you checked that box, you still don't care.  You don't actually want *that* value. 

What I suggest you do, first, is pick on a system in your console which you believe does show your company name when you look at it interactively.  right-click, and look at "resource explorer" for that system.  Browse through each and every class, and see if what you are looking for is being reported already, just not where you thought it was (win32_operatingsystem.organization, because it's not there).  *if* you find it, then you can join that view and pull in the already-exists-in-sql-because-you-found-where-it-lives. 

If you do NOT find it, then it's clearly not "already in sql", and yes, if that is a requirement from someone that you absolutely have to have that value available for reports, you will need to find where that value is stored on the system; whether that is in WMI or in a regkey.  You may have to extend hardware inventory to pull that value into your database, so that it can be in reports.

Free Windows Admin Tool Kit Click here and download it now
May 26th, 2015 4:48pm

Thank you for all of your help!
May 27th, 2015 8:28am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics