Modifying network adapter settings

Welcome Forums General PowerShell Q&A Modifying network adapter settings

This topic contains 4 replies, has 3 voices, and was last updated by

YCE
 
Participant
3 years, 7 months ago.

  • Author
    Posts
  • #24825
    YCE

    Participant
    Points: 12
    Rank: Member

    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

    Moderator
    Points: 24
    Team Member
    Rank: Member

    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

    Participant
    Points: 1
    Rank: Member

    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
    YCE

    Participant
    Points: 12
    Rank: Member

    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
    YCE

    Participant
    Points: 12
    Rank: Member

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

The topic ‘Modifying network adapter settings’ is closed to new replies.