Windows Vista Forums

Win32_NetworkAdapterConfiguration WMI-ness...

  1. #1


    lhoff2005 Guest

    Win32_NetworkAdapterConfiguration WMI-ness...

    Am I not getting something fundamental here?

    Network adapter set to static IP.

    I invoke the following:
    $NIC = Get-WmiObject Win32_NetworkAdapterConfiguration |
    where{$_.ServiceName -eq "NETw4v32"}
    $NIC.EnableDHCP()

    Write-Host "DHCP Enabled: " $NIC.DHCPEnabled

    The output will print false.

    If I again grab $NIC and then ask for
    $NIC.DHCPEnabled



    The output will print true.

    Are WMI objects not stateful? I didn't expect to have to grab a new
    reference in order to check on the status of object properties after
    executing methods on the objects. Please let me know if I'm overlooking some
    basic concept.

    Thanks!

      My System SpecsSystem Spec

  2. #2


    Justin Rich Guest

    Re: Win32_NetworkAdapterConfiguration WMI-ness...

    if i follow your right, i think your asking why doesnt a variable
    automatically update.

    when you assign the results of the get-wmiobject to $NIC, it just takes that
    info and dumps it in to memory, its not a link to the WMI data. its just a
    basic variable storing WMI info.

    "lhoff2005" <lhoff2005@xxxxxx> wrote in message
    news:630F795B-EE68-4B4F-B2D7-C562BC57DF6F@xxxxxx

    > Am I not getting something fundamental here?
    >
    > Network adapter set to static IP.
    >
    > I invoke the following:
    > $NIC = Get-WmiObject Win32_NetworkAdapterConfiguration |
    > where{$_.ServiceName -eq "NETw4v32"}
    > $NIC.EnableDHCP()
    >
    > Write-Host "DHCP Enabled: " $NIC.DHCPEnabled
    >
    > The output will print false.
    >
    > If I again grab $NIC and then ask for
    > $NIC.DHCPEnabled
    >
    > The output will print true.
    >
    > Are WMI objects not stateful? I didn't expect to have to grab a new
    > reference in order to check on the status of object properties after
    > executing methods on the objects. Please let me know if I'm overlooking
    > some
    > basic concept.
    >
    > Thanks!


      My System SpecsSystem Spec

  3. #3


    Hal Rottenberg Guest

    Re: Win32_NetworkAdapterConfiguration WMI-ness...

    lhoff2005 wrote:

    > Are WMI objects not stateful? I didn't expect to have to grab a new
    > reference in order to check on the status of object properties after
    > executing methods on the objects. Please let me know if I'm overlooking some
    > basic concept.
    Nope, you got it. They are not "live" in that respect.

    --
    Author, Tech Prosaic blog (http://halr9000.com)
    Webmaster, Psi (http://psi-im.org)
    Community Director, PowerShellCommunity.org
    Co-host, PowerScripting Podcast (http://powerscripting.net)

      My System SpecsSystem Spec

Win32_NetworkAdapterConfiguration WMI-ness...

Similar Threads
Thread Thread Starter Forum Replies Last Post
Get-WMIObject Win32_NetworkAdapterConfiguration adrianallan PowerShell 2 28 Feb 2010
100% Cpu-ness suprafanatic26 General Discussion 10 05 Jun 2009
Win32_NetworkAdapterConfiguration methods and properties Nikhil R. Bhandari PowerShell 0 16 Mar 2007
Real Estate Leader Sperry Van Ness Selects Full Microsoft Dynamics Suite Solution to Improve Financial Analysis and Continue Explosive Growth z3r010 Vista News 0 21 Nov 2006