WMIQuery.Query
--------------

Executes a query.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [WMIQuery](component_WMIQuery.md) | [5.2](newinversion52.md) | ❌ No | ✅ Yes | ❌ No | ✅ Yes, on Windows | ❌ No |

MBS( "WMIQuery.Query"; WMIQueryRef; Query ) 

**MBS**( **"WMIQuery.Query";** /\* Executes a query. \*/  
**$WMIQueryRef**; /\* The reference to the query. Create it with [WMIQuery.New](WMIQueryNew.md) and destroy them with [WMIQuery.Release](WMIQueryRelease.md).e.g. $ref \*/   
**$Query**) /\* The query to run.e.g. "SELECT \* FROM Win32\_Processor" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| WMIQueryRef | The reference to the query. Create it with [WMIQuery.New](WMIQueryNew.md) and destroy them with [WMIQuery.Release](WMIQueryRelease.md). | $ref |
| Query | The query to run. | "SELECT \* FROM Win32\_Processor" |

### Result

Returns text or error.

### Description

Executes a query.  
Works in FileMaker 14, but fails in FileMaker 15/16 as MBS Plugin can’t upgrade security to administrator and most system queries need permissions.   
  
see also  
<https://msdn.microsoft.com/en-us/library/aa392902(v=vs.85).aspx>  
### Examples

Query network adapters:

 MBS ( "WMIQuery.Query"; $WMIQueryRef ; "Select \* from Win32\_NetworkAdapter" )  
Query details about operation system:

 MBS ( "WMIQuery.Query"; $WMIQueryRef ; "Select \* from Win32\_OperatingSystem" )  
Query event log:

 MBS ( "WMIQuery.Query"; $WMIQueryRef ; "Select \* from Win32\_NTEventLogFile" )  
### See also

- [WMIQuery.Connect](WMIQueryConnect.md)
- [WMIQuery.New](WMIQueryNew.md)
- [WMIQuery.Release](WMIQueryRelease.md)

### Release notes

- **Version 13.2**
    - Fixed a problem where [WMIQuery.Query](https://www.mbsplugins.eu/WMIQueryQuery.shtml) would not report the error message.

### Example Databases

- [Win Only/WMI Query](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Win%20Only/WMI%20Query.shtml#2ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 13.2pr1](https://www.mbsplugins.de/archive/2023-04-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 22nd June 2015 , last changed 9th November 2021

  
[WMIQuery.PropertyValue](WMIQueryPropertyValue.md) - [WMIQuery.Release](WMIQueryRelease.md)

[HTML Version](WMIQueryQuery.shtml)