Hi Everyone,
I’m more sys-admin then I am programmer so here goes.
Running BGinfo to put up system stats on servers (HP mostly) but also employing WMI queries as well.
i.e. pull serial number & product number from WMI query in BGinfo,
SELECT SerialNumber FROM Win32_BIOS = AUB0441HMH
GOOD!
BUT
SELECT OEMStringArray FROM Win32_ComputerSystem
PSF: Product ID: AU663A
BAD!
The second query is what I am having trouble with because when displayed on screen it looks bad.
Is there a way to tidy the output via vbs?
Preferred result just like the first query for the serial:
SELECT OEMStringArray FROM Win32_ComputerSystem = AU663A
This is my attempt and it displays the output to BGInfo but with the same tacky output which needs tidying up but I don’t have a clue how to do that part.
Dim objWMIService Dim colItems ‘Collection returned from the WMI query Dim objItem ‘Each item in the colItems Dim strResult Const wbemFlagReturnImmediately = &h10 Const wbemFlagForwardOnly = &h20 ‘*** Connect to this server’s WMI Service Set objWMIService = GetObject(“winmgmts:\.rootCIMV2”)’Dot is local computer ‘*** Query WMI Set colItems = objWMIService.ExecQuery(“SELECT OEMStringArray FROM Win32_ComputerSystem”, “WQL”, _ wbemFlagReturnImmediately + wbemFlagForwardOnly) For Each objItem In colItems strResult = Join(objItem.OEMStringArray, “,”) Next Echo strResult
So do the brain-trust of Windows Secrets Lounge have any suggestions/solution(s)?
Note: If this is not in the right section please move appropriately.