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!