Modifying network adapter settings

This topic contains 4 replies, has 3 voices, and was last updated by Profile photo of JC JC 2 years ago.

  • Author
    Posts
  • #24825
    Profile photo of JC
    JC
    Participant

    I'm trying to modify multiple NIC properties in one go. So having a table of properties I'm interested in I pipe it to set-netAdapterBinding in this case

    Get-NetAdapterBinding E*1).Enable gives me which ComponentID is anabled for a particular adapter and which is not. So then I try
    @("ms_tcpip6","ms_pacer") | foreach-object {(Set-NetAdapterBinding}.Enabled = $false

    Obviously it doesn't work but I'm not sure why? Could someone help please?

  • #24826
    Profile photo of Daniel Krebs
    Daniel Krebs
    Moderator

    Hi Jarek,

    Please try below:

    Get-NetAdapterBinding -Name E* -ComponentID 'ms_tcpip6','ms_pacer' | ForEach-Object {
        if (-not $PSItem.Enabled) {
            $PSItem | Set-NetAdapterBinding -Enabled:$false
        }
    }
    

    Best,
    Daniel

  • #24827
    Profile photo of Jason Wasser
    Jason Wasser
    Participant

    It looks like you need to specify the parameter by name.

    -ComponentID
    Specifies the underlying name of the transport or filter in the following
    form.
      ?  ms_xxxx, such as ms_tcpip.

    Required? false
    Position? named
    Default value
    Accept pipeline input? false
    Accept wildcard characters? true

    Get-NetAdapterBinding | Set-NetAdapterBinding -ComponentID ms_tcpip6,ms_pacer

  • #24828
    Profile photo of JC
    JC
    Participant

    Thanks Daniel. It doesn't throw any erros back at me but it doesn't change anything either for some reason. That is the values remain True after running the script.

  • #24830
    Profile photo of JC
    JC
    Participant

    After commenting out the if condition it worked but not sure why again 🙂

You must be logged in to reply to this topic.