Jump to content
Sign in to follow this  

Strange WMI problem on Intel hardware

Recommended Posts

The rest of my post isn't showing up... Here it is in a new reply, maybe that will help.

I have determined what is causing this error, and at which point, but not why and have not been able to determine a way to program around it. I am actually seeing this error in any application that reads from the WMI, here is an example script:
$sWMIService = "winmgmts:\\" & @ComputerName & "\root\CIMV2"
$objWMIService = ObjGet($sWMIService)
IF IsObj($objWMIService) Then
    $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem")
    If IsObj($colItems) Then
        For $oItem In $colItems
            $sModel = StringReplace( $oItem.Model , "/" , "" )
The application reads from WMI to get the Model number for 2 reasons. 1 it displays it on the screen and 2 it looks up that value on the server so that it can generate the GUI. Obviously, if the field is empty an error is generated. However, it does not care if it cannot find the value on the server, as if the value does not match, it shows a default message. So the way it is currently written, I know exactly what the error means when it appears. It means the field is empty. There was only 1 hardware I had where the field actually WAS empty, and it was a prototype unit. If a production unit had no value there, we would defect it out for obvious reasons.
Now on to where the error occurs. The application is compiled for 64bit.
Case where error occurs (not 100% of hardware, but 100% on the hardware it happens on unless workaround.)
- Intel BIOS has both UEFI and Legacy Boot enabled.
- BIOS-level PXE* boot to WinPE 4.0 x64
- Run application
- WMI value is an object, but the object is empty, or null.
* I don't think PXE is a requirement, but I don't boot via CD or USB.
- Disable UEFI boot in the BIOS.
If you can think of any thing I could try to find out what the problem could be, let me know. I may end up posting this question elsewhere as well.
For those who are interested, hardware effected:
Intel DB75EN
Intel NUC (D33217GKE/DC3217YE)
Edited by Tripredacus

Share this post

Link to post
Share on other sites

And...? Did you mean to put this in Chat, or do you have a specific script to post that is giving you problems??


Edit: LOL, I was wondering - not like you to post a bunch of nothing like that :)

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Share this post

Link to post
Share on other sites

What variable is not being declared correctly? (You should do some error trapping see @error and seterror()) also you could run the script in scite(F5) on an affected machine to show when the program fails)


It is not a problem with variables being declared incorrectly.

I already know what the "error" is, the variable is an object but there is no data in it.

I have not been able to replicate this from a running OS, only from WinPE.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Similar Content

    • By ModemJunki
      So there was a topic on the General Help and Support board where the poster mentioned it was not easy to check if the system was installed with UEFI or legacy mode and it got me looking down a rabbit hole. Apparently you can't just whip up a simple WMI query to find that out.
      But I did find that you can read the output of bcdedit.exe to check if the system is using winload.efi or winload.exe, so then I got stuck because bcdedit doesn't play nice with StdoutRead. Finally I discovered that toggling Wow64DisableWow64FsRedirection would make it all work together.
      I hope this helps someone. Maybe it can be simplified, I'm no expert. 🤨
      DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1) $aArray = StringSplit(_getDOSOutput("bcdedit.exe"), @CRLF) DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 0) For $i = 1 To UBound($aArray) - 1 Select Case StringInStr($aArray[$i], 'Windows Boot Loader') And StringInStr($aArray[$i + 3], 'device partition=C:') And StringInStr($aArray[$i + 4], 'winload.efi') ConsoleWrite("UEFI mode" & @CRLF) Case StringInStr($aArray[$i], 'Windows Boot Loader') And StringInStr($aArray[$i + 3], 'device partition=C:') And StringInStr($aArray[$i + 4], 'winload.exe') ConsoleWrite("Legacy BIOS" & @CRLF) EndSelect Next Func _getDOSOutput($command, $wd = '') ; https://www.autoitscript.com/forum/topic/190249-get-result-of-shellexecute/ Local $text = '', $Pid = Run('"' & @ComSpec & '" /c ' & $command, $wd, @SW_HIDE, 2 + 4) While 1 $text &= StdoutRead($Pid, False, False) If @error Then ExitLoop Sleep(10) WEnd Return StringStripWS($text, 7) EndFunc ;==>_getDOSOutput  
    • By jresine
      Hello, is it possible to know via a script or command, to have the percentage of disk usage of a process? thank you in advance.
      ps: see image

    • By Dwalfware
      Another head scratched
      Anyone solve how to get the IPV6 from WMI?
      I followed the usual SELECT * FROM Win32_NetworkAdapter WHERE NetConnectionID='" & GUICtrlRead($cboAdapters) & "'
      get the index 
      port it to 
      Local $query = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE Index = " & _GetSelectedNIC(), "WQL", 0x30 )
      All i can see is IPv4 addresses
      My question is is there another place the IPv6 information is hiding? I configured my LAN with IPV6 and my wireless with IPv4 so I can see what shows.
      Thanks in Advance.
      PS. I did try google
    • By Dwalfware
      Hi Folks
      Can not get my head around this one.
      This function gets the DNS object s
      If you have two DNS entries fine. but if you have only one! Trouble
      $objItem.DNSServerSearchOrder[0] = Primary DNS
      $objItem.DNSServerSearchOrder[1] = Secondry DNS not always there. I need a way to return 0 if not there or the IP if its there.
      Or is there a way to tell how many objects there are in the "[?]"
      I'm terrible at WMI errors, thanks for help in advance.
      Func _GETcurrentNICinfo2() $oErrors = ObjEvent("AutoIt.Error", "Error_Handle") Local $DnsSecondry Local $objWMIService = ObjGet( "winmgmts:\\" & @ComputerName & "\root\CIMV2" ) Local $query = $objWMIService.ExecQuery("SELECT DNSServerSearchOrder FROM Win32_NetworkAdapterConfiguration WHERE Index = " & _GetSelectedNIC(), "WQL", 0x30 ) If @error Then Return 0 If NOT IsObj($query) Then Return 0 Else For $objItem In $query Return $objItem.DNSServerSearchOrder[1] next Endif EndFunc  
    • By amin84
      I'm having trouble getting information from Win32_Processor:
      How does this WMI Query work? Let's say I need to query VMMonitorModeExtensions, Level, ProcessorId, and ProcessorType.
      How would this work?
  • Create New...