I have several clients who use computer-naming conventions. They record and maintain these conventions in the Description field in Windows NT 4.0's Server Manager. My clients' computers frequently change owners, so I want to automate the process of modifying the Description field. I was hoping to use Active Directory Service Interfaces (ADSI), but ADSI doesn't seem to support the Description field in Server Manager. After some investigation, I learned that I can modify two registry subkeys to edit the Description field, but I would need to reboot the machine to have Server Manager reflect the changes. Are you aware of another way to change the Description field that doesn't require a reboot?
As it turns out, you can use ADSI to manage the Description field displayed in NT 4.0's Server Manager. However, ADSI's IADsComputer interface doesn't expose the setting. Server Manager's Description field is set on the Server Service for the computer. Thus, ADSI's IADsFileService interface exposes this setting, and you use this interface's Description property to modify the setting.
Listing 4, page 12, demonstrates how to use the IADsFileService Description property to change a computer's description in Server Manager. (Network Neighborhood's Comment field also displays the values you set in Server Manager's Description field.) The key to the script is binding to the target computer's Server Service, as callout A in Listing 4 shows. The actual name of the Server Service is LanmanServer; Server just happens to be the display name in the Control Panel Services applet. The FileService qualifier at the end of the bind string is an optimization that tells the WinNT provider the class of object to which to connect. This qualifier limits the number of objects the WinNT provider must examine to locate the target object. (This optimization is available only with ADSI's WinNT provider.)
After the script binds to the target computer's Server Service, you use the IADsFileService Description property to modify the computer's description and call the SetInfo method to commit the change. Unlike the registry-based solution that requires a reboot, the ADSI-initiated change is immediate and doesn't require one.