locked
How to use powershell script to close ipv6 for multiple virtual network cards? RRS feed

  • Question

  • Hi everyone,

    I'm trying to use powershell script to turn off ipv6 for my multiple virtual network cards, but I failed.

    Could anyone tell me what I did wrong?

    Thank you in advance.

    $vmnets=Get-NetAdapter | Where-Object {$_.name -like "*vmnet*"} | Select-Object name
    foreach ($vmnet in $vmnets){
        Disable-NetAdapterBinding -Name "$vmnet" -ComponentID "ms_tcpip6"
    }

    Best regards,

    Yuxiang


    Please remember to mark the replies as answers if they help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    • Edited by Yuxiang Shi Monday, November 25, 2019 8:46 PM
    Monday, November 25, 2019 8:45 PM

Answers

  • Please remember that we cannot read Chinese.

    The error says that there is no binding with that ID on at least one adapter.

    This will tell you who has that binding.

    Get-NetAdapterBinding  *vmnet* -ComponentID ms_tcpip6 | select Name, Enabled


    \_(ツ)_/

    • Marked as answer by Yuxiang Shi Monday, November 25, 2019 10:15 PM
    Monday, November 25, 2019 9:34 PM

All replies

  • Please remember that we cannot read Chinese.

    The error says that there is no binding with that ID on at least one adapter.

    This will tell you who has that binding.

    Get-NetAdapterBinding  *vmnet* -ComponentID ms_tcpip6 | select Name, Enabled


    \_(ツ)_/

    • Marked as answer by Yuxiang Shi Monday, November 25, 2019 10:15 PM
    Monday, November 25, 2019 9:34 PM
  • Hi jrv,

    Thank you very much.

    It worked!

    Get-NetAdapterBinding  *vmnet* -ComponentID ms_tcpip6 | select Name, Enabled | Where-Object {$_.Enabled -eq "True"} | Disable-NetAdapterBinding -ComponentID ms_tcpip6

    Best regards,

    Yuxiang


    Please remember to mark the replies as answers if they help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Monday, November 25, 2019 10:17 PM
  • Why do you new techs always insist on copying everyth9ing without understanding anything. Try taking some time to learn basic PowerShell./

    This is all you need.

    Disable-NetAdapterBinding *vmnet* -ComponentID ms_tcpip6

    Why write unnecessary code. It is a bad habit and can lead to issues that are hard to resolve.


    \_(ツ)_/

    Monday, November 25, 2019 10:23 PM