ActiveXperts.com » Administration » Scripts » Adsi » Remove a computer from a domain - vbscript

Remove a computer from a domain - vbscript

Active Directory Services Interface (ADSI) is a set of COM (Common Object Model) programming Interfaces. Like ODBC, ADSI provides common access to directories by adding a provider for each directory protocol type.

You can use any of the VBScript programs below in ActiveXperts Network Monitor. Click here for an explanation about how to include scripts in ActiveXperts Network Monitor.

On this site, you can find many ADSI samples.

The remove-a-computer-from-a-domain ADSI class can be used in ActiveXperts Network Monitor to monitor your servers.


Example(s)

Sub RemoveComputer( strDomain, strComputer )
    Dim objDC
    Set objDC = getobject("WinNT://" & strDomain )
    objDC.Delete( "Computer", strComputer )
End Sub

Dim strDomain, strComputer
Do
    strDomain = inputbox( "Please enter a domainname", "Input" )
Loop until strDomain <> ""
Do
    strComputer = inputbox( "Please the name of the computer to be removed from the domain", "Input" )
Loop until strComputer <> ""
RemoveComputer strDomain, strComputer
WScript.Echo "Done."
M