|
jsandys -> RE: Check for disabled computer accounts in AD (6/19/2008 10:44:24 PM)
|
OK. Here's a sample script from the Technet script repository: http://www.microsoft.com/technet/scriptcenter/scripts/default.mspx?mfr=true. This script gets info about a computer object, an IADsComputer object in ADSI term.s If you look up IADsComputer in MSDN, there is unfortunately no reference to any property or method talking about the acocunt being disabled. Fear not though. If you look up the AD schema in MSDN (http://msdn.microsoft.com/en-us/library/ms680987(VS.85).aspx), you will see that the Computer is a subclass of the User class, thus everything that applies to a User object (IADsUser ADSI interface) also applies to the Computer object (IADsComputer interface). If you do a web search on IADsComputer and AccountDisabled, you'll get the following link which also eludes to this but they are talking .Net code so it doesn;t exactly translate: http://www.ondotnet.com/pub/a/dotnet/2003/08/04/activedir.html Thus we have the following: Set objComputer = GetObject _ ("LDAP://CN=atl-dc-01,CN=Computers,DC=fabrikam,DC=com") objProperty = objComputer.Get("AccountDisabled") Wscript.Echo "Account is Disabled: " & objProperty
|
|
|
|