NIS Server snap-in throws WMI error

When we try to open Server for NIS administration snap-in; a very common issue that is reported is getting an error message like: “A WMI error has occurred. Index was out of range. Must be non-negative and less than the size of the collection”.

At a glance this message appears to be confusing. We were trying to track to internal cause. It turned out to be related to in-built search for All NIS Server in the domain. The NIS Admin snap-in searches for “serverreference” attributes in the domain and then tries to look for “gecos” attribute to determine if a domain controller is actually working as a NIS Master Server.

When a domain controller is decommissioned generally the object for that system remains in the schema but with a null value in the corresponding “serverreference” attribute. There can be other reasons to have a corrupt value in the “serverreference” attribute.

The way to fix this is to either delete the invalid machine account from schema or to put a proper value in the serverreference attribute. On this is done; restarting NIS admin snap-in should be enough to eliminate the “WMI error”.

We have a script ready to look for the servers and check the value for serverreference attribute. It can be given on need basis.