Shell Issue

So, I’m using WMIC to return system information and the following shell command works fine under Windows 7 & 8:

shell.execute(“wmic get bios version”)

However, under Windows XP the same shell execute returns nothing… instead invoking a time out. This is true even if I set the timeout to over 10 seconds. The same command run from the command-line under XP runs just find and displays the expected result in under a second. Any ideas?

You could try our WMI Plugin classes instead. maybe they work better?

Apparently, this is an old issue…

http://forums.realsoftware.com/viewtopic.php?f=1&t=45163

Not sure why it works under other Windows OS’, but fails to capture the results only when under XP (using XP Pro SP3 btw).

WMI is not available on XP Home Edition, and wmic.exe is not necessarily installed on XP Professional.

Instead of shell you can also uses the WMI Classes: http://library.wmifun.net/cimv2/win32_bios.html by use of oleobject. But this will only works from Windows Vista and upwards.

Attached an bios example.

[code] dim locator as oleobject
dim services as oleobject
dim objs as oleobject
dim obj as oleobject
dim prop as oleobject
dim propSet as oleobject

dim i as integer
dim j as integer

dim tempstr as string

// See http://library.wmifun.net/cimv2/win32_bios.html For the exact number of properties

dim WmiProperties() as string
redim WmiProperties(26)

WmiProperties(0) = “BiosCharacteristics”
WmiProperties(1) = “BIOSVersion”
WmiProperties(2) = “BuildNumber”
WmiProperties(3) = “Caption”
WmiProperties(4) = “CodeSet”
WmiProperties(5) = “CurrentLanguage”
WmiProperties(6) = “Description”
WmiProperties(7) = “IdentificationCode”
WmiProperties(8) = “InstallableLanguages”
WmiProperties(9) = “InstallDate”
WmiProperties(10) = “LanguageEdition”
WmiProperties(11) = “ListOfLanguages”
WmiProperties(12) = “Manufacturer”
WmiProperties(13) = “Name”
WmiProperties(14) = “OtherTargetOS”
WmiProperties(15) = “PrimaryBIOS”
WmiProperties(16) = “ReleaseDate”
WmiProperties(17) = “SerialNumber”
WmiProperties(18) = “SMBIOSBIOSVersion”
WmiProperties(19) = “SMBIOSMajorVersion”
WmiProperties(20) = “SMBIOSMinorVersion”
WmiProperties(21) = “SMBIOSPresent”
WmiProperties(22) = “SoftwareElementID”
WmiProperties(23) = “SoftwareElementState”
WmiProperties(24) = “Status”
WmiProperties(25) = “TargetOperatingSystem”
WmiProperties(26) = “Version”

dim params1(2) as variant
params1(1) = “.”
params1(2) = “root\cimv2”

locator = new oleObject(“WbemScripting.SWbemlocator”, true)
services = locator.invoke(“ConnectServer”, params1)

dim params2(1) as variant
params2(1) = “Select * From Win32_BIOS”
objs = services.invoke(“execQuery”, params2)

for i = 0 to objs.invoke(“Count”) -1

obj = objs.ItemIndex(i)

propSet = obj.invoke("Properties_")

for j = 0 To UBound(WmiProperties)-1
  
  prop = propSet.Item(WmiProperties(j), 0)
  if isnull(prop.Value) = true then
    tempstr = tempstr + prop.Name + EndOfLine
  else
    if prop.IsArray = true then
      tempstr = tempstr + prop.Name + EndOfLine
    else
      tempstr = tempstr + prop.Name + ":    " + prop.Value + EndOfLine
    end if
  end if
  
next
exit

next

msgbox tempstr

exception err as oleexception
msgbox err.message

[/code]

@John Hansen - I have been looking at ways to access WMI, this is hugely helpful. Greatly appreciated.

John, that worked beautifully… thank you, sir!

Eric, the WFS also has some useful tools.

Thanks, I’ll look into that. I haven’t used the WFS in a couple of years… so it’s probably been updated a bit since then.

Thank you John!