I have a TXT file list of computers to disable or delete. I can delete with:
I've seen code which is supposed to disable, but it uses GetObject("LDAP://" CN=, OU=, OU=, etc), which I don't have, the computer objects on the list are scattered all over the AD.
I'm wanting something like this, only that works
but this gives me 'error, Activex component can't create object' on the first line.
Can anyone tell me how to either disable the AD computer account using GetObject("WinNT://....., or tell me how to derive the Distingushed Name from it so I can do it using the GetObject("LDAP://"........?
Thanks,
Jerz
Code:
Set DomainObj = GetObject("WinNT://" & "DomainNameString")
DomainObj.Delete "computer", "ComputerNameString"
I've seen code which is supposed to disable, but it uses GetObject("LDAP://" CN=, OU=, OU=, etc), which I don't have, the computer objects on the list are scattered all over the AD.
Code:
Set objComputer = GetObject("LDAP://" & strComputerDN, vbNullString)
objComputer.AccountDisabled = True
objComputer.SetInfo
I'm wanting something like this, only that works
Code:
Set CompObj = GetObject("WinNT://" & "DomainNameString" & "ComputerNameString","computer")
CompObj.AccountDisabled = True
CompObj.SetInfo
Can anyone tell me how to either disable the AD computer account using GetObject("WinNT://....., or tell me how to derive the Distingushed Name from it so I can do it using the GetObject("LDAP://"........?
Thanks,
Jerz