Configure a specific network adapter with Get-WmiObject win32-networkadapterconfiguration

Answered Configure a specific network adapter with Get-WmiObject win32-networkadapterconfiguration

  • Wednesday, February 13, 2013 3:41 PM
     
     

    Hi guys,

    So here's my problem I hope you can help me. I have two virtual network adapters (VLANs) in my computer (NIC001 and NIC002). I failed at managing each VLAN individually. NIC001 has to be with DHCP and NIC002 has to be with a static IP and no gateway and no DNS.

    How I have to manage this?

    I'm looking forward to your answers.
    Greets Mike

All Replies

  • Wednesday, February 13, 2013 4:16 PM
    Moderator
     
     

    Hi,

    What's your scripting question?

    Bill

  • Thursday, February 14, 2013 7:38 AM
     
     

    Hi Bill,

    My question is: How can I manage those NICs or VLANs individually with this WMI-Object? I know there's a filter function but somehow it doesn't work. A few examples would help me! Oh yeah, I have to work with PS 2.0.

    Greets Mike

  • Thursday, February 14, 2013 11:45 AM
     
     Answered

    I found the answer:

    For example the NIC001 is an Intel(R) PRO/1000 MT Network Connection:

    $wmi = Get-WmiObject win32_networkadapterconfiguration -filter "Description like '%1000%'" #Filter is in WQL-Language and % is the wildcard in WQL
    $wmi.EnableStatic("$ip", "$netmask")
    $wmi.SetGateways("$gateway", 1)
    $wmi.SetDNSServerSearchOrder("$dns")

    But thank you for the help!

    Greets Mike

    • Marked As Answer by mike170194 Thursday, February 14, 2013 11:46 AM
    •