locked
Win32_NetworkAdapterConfiguration SetWINSServer RRS feed

  • Question

  • Every time I think I've seen WINS for the last time I run into it again.

    I was working on a script to help clean up an environment's WINS and I've run into a problem.  I try to use the .SetWINSServer method and it returns success but doesn't actually work.  

    Here is the part of the script that seems to be failing

    (Get-WmiObject Win32_NetworkAdapterConfiguration -ComputerName Server02 | ?{$_.IPEnabled}).SetWINSServer("","")


    __GENUS          : 2
    __CLASS          : __PARAMETERS
    __SUPERCLASS     :
    __DYNASTY        : __PARAMETERS
    __RELPATH        :
    __PROPERTY_COUNT : 1
    __DERIVATION     : {}
    __SERVER         :
    __NAMESPACE      :
    __PATH           :
    ReturnValue      : 0
    PSComputerName   :

    But when I check, the values are still configured

    (Get-WmiObject Win32_NetworkAdapterConfiguration -ComputerName Server02 | ?{$_.IPEnabled}).WINSPrimaryServer
    10.1.1.2

    (Get-WmiObject Win32_NetworkAdapterConfiguration -ComputerName Server02 | ?{$_.IPEnabled}).WINSSecondaryServer
    10.1.1.3

    does the .SetWINSServer method still work?  I'm sure I've used this 10+ years ago, probably in VBScript at the time, maybe I don't have the syntax quite right.  I just hope to wrap some automation into this WINS removal project.

    Thanks,

    Joe


    Joseph M. Durnal MCM: Exchange 2010 MCITP: Enterprise Messaging Administrator, Exchange 2010 MCITP: Enterprise Messaging Administrator, MCITP: Enterprise Administrator

    Thursday, September 26, 2019 6:13 PM

All replies

  • Please refer to the documentation:

    https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/setwinsserver-method-in-class-win32-networkadapterconfiguration

    If WINS is set by DHCP as it should be when used then this will not work.


    \_(ツ)_/

    Thursday, September 26, 2019 6:27 PM
  • Hi,

    Was your issue resolved?

    If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.

    If you resolve it using your own solution, please share your experience and solution here. It will be very beneficial for other community members who have similar questions.

    If no, please reply and tell us the current situation in order to provide further help.

    Best Regards,

    Lee


    Just do it.

    Thursday, October 3, 2019 2:05 AM
  • Thanks for following up, the issue isn't resolved yet.  I'm familiar with the documentation linked and these are not DHCP systems.  I'll be working on this some more today and should I resolve it myself, I'll be sure to update the thread with the solution.

    J


    Joseph M. Durnal MCM: Exchange 2010 MCITP: Enterprise Messaging Administrator, Exchange 2010 MCITP: Enterprise Messaging Administrator, MCITP: Enterprise Administrator

    Friday, October 4, 2019 5:31 PM
  • You cannot set wins to an empty string.  Try $null for the parameters.


    \_(ツ)_/

    Friday, October 4, 2019 5:40 PM
  • I would use this method:

    Get-WmiObject Win32_NetworkAdapterConfiguration -Filter 'IPEnabled=True' -ComputerName $server |
        Invoke-WmiMethod -Name SetWINSServer -ArgumentList @('','')


    \_(ツ)_/

    Friday, October 4, 2019 5:53 PM
  • Problem is the end user (me).

    My check was on the same WMI call.  In my effort to sanitize I didn't quite write it the way my script did it.

    It was more like:

    $Network = Get-WmiObject Win32_NetworkAdapterConfiguration -ComputerName Server02 | ?{$_.IPEnabled}$Network.SetWINSServer("","")

    Then I would run the check
    $network.WINSPrimaryServer ...

    Without calling the Get-WMIObject again.

    Of course, the $Network still had the old information.

    Thanks for offering the help though.  You guys were right, it works, I was just validating it wrong.

     

    Joseph M. Durnal MCM: Exchange 2010 MCITP: Enterprise Messaging Administrator, Exchange 2010 MCITP: Enterprise Messaging Administrator, MCITP: Enterprise Administrator


    Thursday, October 10, 2019 9:51 PM