Introduction to System.DirectoryServices, Part 2
Subject:   Code may not work as described
Date:   2004-09-30 00:15:05
From:   Wrayx1
Robbie describes using the NativeObject, however the code objChild.NativeObject.AccountDisabled = False will not compile because it isn't a property of NativeObject. Instead try this (in C# - but similar in VB.NET)
ActiveDs.IADsUser objIADsUser = (ActiveDs.IADsUser) objChild.NativeObject;
objIADsUser.AccountDisabled = true;

What however is more interesting is that there is no AccountDisabled property for IADsComputer, but you can certainly right click on it in Active Directory and disable it. If you pretend the computer is a a user object, in VBScript you can disable the computer account (according to other examples on the web) so in theory you should be able to do it in .NET too by using IADsUser. If not I'd like to see a .NET method of disabling a computer that someone has created.