TX T
TX T

Reputation: 817

PowerShell / WMI to set MSNdis_currentpacketfilter

I like to know if there is a way to use PowerShell with WMI to set the MSNdis_currentPacketFilter

PS > Get-WmiObject -class "MSNdis_CurrentPacketFilter" -NameSpace "root\WMI" -Filter "InstanceName='Intel(R) Ethernet Server Adapter I350-T2'"

__GENUS                 : 2
__CLASS                 : MSNdis_CurrentPacketFilter
__SUPERCLASS            : MSNdis
__DYNASTY               : MSNdis
__RELPATH               : MSNdis_CurrentPacketFilter.InstanceName="Intel(R) Ethernet Server Adapter I350-T2"
__PROPERTY_COUNT        : 3
__DERIVATION            : {MSNdis}
__SERVER                : HYPERV88
__NAMESPACE             : root\WMI
__PATH                  : \\HYPERV88\root\WMI:MSNdis_CurrentPacketFilter.InstanceName="Intel(R) Ethernet Server Adapter
                          I350-T2"
Active                  : True
InstanceName            : Intel(R) Ethernet Server Adapter I350-T2
NdisCurrentPacketFilter : 15
PSComputerName          : HYPERV88

And I would like to change the NdisCurrentPacketFilter value from 15 to 47.

I tried

Set-WMIInstance -Path ... -Arguments @{NdisCurrentPacketFilter=47}

But, got error. Thanks in advance!

===== added 04/17/2015 Here were the commands I tried:

$p=$(Get-WmiObject -class "MSNdis_CurrentPacketFilter" -NameSpace "root\WMI" -Filter "InstanceName='Intel(R) Ethernet Server Adapter I350-T2'").__Path
Write-Host $p
\\HYPERV88\root\WMI:MSNdis_CurrentPacketFilter.InstanceName="Intel(R) Ethernet Server Adapter I350-T2"
Set-WmiInstance -Path $p -Arguments @{NdisCurrentPacketFilter=47}

and error (not sure why it said command not found, but command was valid)

Set-WmiInstance : Not found
At line:1 char:1
+ Set-WmiInstance -Path $p -Arguments @{NdisCurrentPacketFilter=47}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Set-WmiInstance], ManagementException
    + FullyQualifiedErrorId : SetWMIManagementException,Microsoft.PowerShell.Commands.SetWmiInstance

And I tried this:

$o = Get-WmiObject -class "MSNdis_CurrentPacketFilter" -NameSpace "root\WMI" -Filter "InstanceName='Intel(R) Ethernet Server Adapter I350-T2'"
Write-Host $o
\\HYPERV88\root\WMI:MSNdis_CurrentPacketFilter.InstanceName="Intel(R) Ethernet Server Adapter I350-T2"
Set-WMIInstance -class "MSNdis_CurrentPacketFilter" -InputObject $o -Arguments @{NdisCurrentPacketFilter=47}
Set-WmiInstance : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
+ Set-WMIInstance -class "MSNdis_CurrentPacketFilter" -InputObject $o -Arguments @ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Set-WmiInstance], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.PowerShell.Commands.SetWmiInstance

Upvotes: 0

Views: 766

Answers (1)

Matt
Matt

Reputation: 46730

I think you are having this issue as according to scriptinternals that value is read-only.

NdisCurrentPacketFilter

  • Data type: integer/usint32
  • Access type: Read-only

I found similar information here as well. You should have wrote your error here as well. It might have added context to your issue and it is a best practice when asking questions.

Disclaimer: I know nothing about the class. Just wanted to see if anyone posted details of the class parameters.

Upvotes: 0

Related Questions