问题描述
b
$
我试图用C ++和WMI写出powershell命令的模拟 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"
我尝试了多种方法,但没有一种方法可行:
1)a)枚举MSFT_NetQosFlowControlSettingData类实例
  b)修改 Enabled,InterfaceAlias,InterfaceIndex和PolicySet属性
  c)应用更改
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直接使用 \\.\ROOT \StandardCimv2:MSFT_NetQosFlowControlSettingData.InstanceID =" Priority3"路径
  b) 修改 Enabled,InterfaceAlias,InterfaceIndex和PolicySet属性
  c)应用更改
3) a)使用MSFT_NetQosFlowControlSettingData获取GetObject
      b)此类的Spawn实例     c)
修改 启用,InterfaceAlias,InterfaceIndex和PolicySet属性       d) 应用更改
所有函数调用成功,但结果是我获得了针对Global PolicySet的优先级3,而没有针对AdapterSpecific PolicySet:
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
如果我使用powershell命令进行配置,我会得到预期的结果:
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
有人可以帮助我,或者建议一些不同的方法吗?
b
$
谢谢你,b $ b $ Alexander
Could someone help me, or advice some different approaches?
Thanks,
Alexander
推荐答案
由于您的问题与C ++更相关,我将把它移到Visual C ++论坛以获得适当的支持。
Since your question is more related to C++, I will move it to Visual C++ forum for suitable support.
CLR论坛讨论并提出有关.NET Framework基础类的问题(BCL)如收藏,I / O,Regigistry,Globalization,Reflection。还讨论了构建或扩展.NET Framework的所有其他Microsoft库,包括Managed
可扩展性框架(MEF),图表控件,CardSpace,Windows Identity Foundation(WIF),销售点(POS),事务处理。
The CLR Forum discuss and ask questions about .NET Framework Base Classes (BCL) such as Collections, I/O, Regigistry, Globalization, Reflection. Also discuss all the other Microsoft libraries that are built on or extend the .NET Framework, including Managed Extensibility Framework (MEF), Charting Controls, CardSpace, Windows Identity Foundation (WIF), Point of Sale (POS), Transactions.
最好的问候,
Wendy
这篇关于如何使用WMI和C ++更改MSFT_NetQosFlowControlSettingData实例的PolicySet参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!