How to change PolicySet parameter of MSFT_NetQosFlowControlSettingData instance using WMI and C++

  • Thread starter Thread starter Alexander Gurevich
  • Start date Start date
A

Alexander Gurevich

Guest
Hi,

I`m trying to write analog of powershell command using C++ and WMI infrastructure

Set-NetQosFlowControl -Priority 3 -Enabled $true -InterfaceAlias "Ethernet 4"


The tricky part is the last parameter and how to set it

-InterfaceAlias "Ethernet 4"

I tried multiple approaches but none of them worked:

1) a) Enumerate on MSFT_NetQosFlowControlSettingData class instances
b) Modify Enabled, InterfaceAlias, InterfaceIndex and PolicySet properties
c) Apply changes

2) a) GetObject directly using \\.\ROOT\StandardCimv2:MSFT_NetQosFlowControlSettingData.InstanceID="Priority3" path
b) Modify Enabled, InterfaceAlias, InterfaceIndex and PolicySet properties
c) Apply changes

3) a) GetObject using MSFT_NetQosFlowControlSettingData
b) Spawn instance of this class c) Modify Enabled, InterfaceAlias, InterfaceIndex and PolicySet properties d) Apply changes

All function calls success, but as the result I get Priority 3 enalbed for Global PolicySet and not for AdapterSpecific PolicySet:

Get-NetQosFlowControl
Priority Enabled PolicySet IfIndex IfAlias
-------- ------- --------- ------- -------
0 False Global
1 False Global
2 False Global
3 True Global
4 False Global
5 False Global
6 False Global
7 False Global

Get-NetQosFlowControl -InterfaceAlias "Ethernet 4"



Priority Enabled PolicySet IfIndex IfAlias
-------- ------- --------- ------- -------
0 False AdapterSpecific 16 Ethernet 4
1 False AdapterSpecific 16 Ethernet 4
2 False AdapterSpecific 16 Ethernet 4
3 False AdapterSpecific 16 Ethernet 4
4 False AdapterSpecific 16 Ethernet 4
5 False AdapterSpecific 16 Ethernet 4
6 False AdapterSpecific 16 Ethernet 4
7 False AdapterSpecific 16 Ethernet 4



If I use powershell commands for configuration I get the expected result:

Set-NetQosFlowControl -Priority 3 -Enabled $true -InterfaceAlias "Ethernet 4"
Get-NetQosFlowControl

Priority Enabled PolicySet IfIndex IfAlias
-------- ------- --------- ------- -------
0 False Global
1 False Global
2 False Global
3 False Global
4 False Global
5 False Global
6 False Global
7 False Global

Get-NetQosFlowControl -InterfaceAlias "Ethernet 4"

Priority Enabled PolicySet IfIndex IfAlias
-------- ------- --------- ------- -------
0 False AdapterSpecific 16 Ethernet 4
1 False AdapterSpecific 16 Ethernet 4
2 False AdapterSpecific 16 Ethernet 4
3 True AdapterSpecific 16 Ethernet 4
4 False AdapterSpecific 16 Ethernet 4
5 False AdapterSpecific 16 Ethernet 4
6 False AdapterSpecific 16 Ethernet 4
7 False AdapterSpecific 16 Ethernet 4



Could someone help me, or advice some different approaches?

Thanks,
Alexander

Continue reading...
 
Back
Top