Skip to content

Conversation

@SteveL-MSFT
Copy link
Member

@SteveL-MSFT SteveL-MSFT commented Sep 14, 2024

PR Summary

Previously, all the properties for a WMI class gets returned. With this change, the specified properties get turned into a query. This can actually improve performance if the WMI provider supports it, but otherwise it also means the output won't have information that the configuration did not request.

If a property has a value, then that value is used as part of the query.

Example output using the updated wmi inventory example:

results:
- metadata:
    Microsoft.DSC:
      duration: PT1.0536124S
  name: WMI
  type: Microsoft.Windows/WMI
  result:
    actualState:
    - Model: Virtual Machine
      Domain: WORKGROUP
      Name: CPC-slee-8MW0NA
      Manufacturer: Microsoft Corporation
      TotalPhysicalMemory: 68665831424
    - Caption: Microsoft Windows 11 Enterprise
      OSArchitecture: 64-bit
      OSLanguage: 1033
      Version: 10.0.22631
    - SerialNumber: 9040-0535-4797-8220-8672-1612-79
      Manufacturer: Microsoft Corporation
      Model: null
    - SerialNumber: 0000-0011-2510-4748-5887-4988-97
      Manufacturer: Microsoft Corporation
      Version: VRTUAL - 1
    - MACAddress: 00:22:48:C1:70:B2
      ServiceName: netvsc
      NetConnectionID: Ethernet 6
      NetConnectionStatus: 2
      Name: 'Microsoft Hyper-V Network Adapter #5'
      AdapterType: Ethernet 802.3

Also fixed how the adapter writes traces so they show up correctly.

PR Context

Address a part of #475

Steve Lee (POWERSHELL HE/HIM) (from Dev Box) and others added 2 commits September 15, 2024 07:38
$stdinput
)

trap {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to have a comment about what this trap does.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, will add comment

adaptertype:
netconnectionid:
serviceName:
netconnectionstatus: 2

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is my understanding correct that this is the only instance in this file that will use WHERE clause?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

@SteveL-MSFT SteveL-MSFT added this pull request to the merge queue Sep 17, 2024
Merged via the queue into PowerShell:main with commit 01bc057 Sep 17, 2024
@SteveL-MSFT SteveL-MSFT deleted the demo branch September 17, 2024 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants