VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



ADSI sample - removes a computer from a domain by deleting its computer account. Written in VBScrip

by Anonymous (267 Submissions)
Category: Windows System Services
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Sun 4th May 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

ADSI sample - removes a computer from a domain by deleting its computer account. Written in VBScript, using ADSI.

Rate ADSI sample - removes a computer from a domain by deleting its computer account. Written in VBScrip



' This script removes a computer from a domain by deleting its computer account

' Goto http://www.activexperts.com/activmonitor and click on ADSI Samples
' for more samples


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



' Main

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."

WScript.Echo( vbCrlf & "For more samples, goto http://www.activexperts.com/activmonitor and click" )
WScript.Echo( "on ADSI samples" )

Download this snippet    Add to My Saved Code

ADSI sample - removes a computer from a domain by deleting its computer account. Written in VBScrip Comments

No comments have been posted about ADSI sample - removes a computer from a domain by deleting its computer account. Written in VBScrip. Why not be the first to post a comment about ADSI sample - removes a computer from a domain by deleting its computer account. Written in VBScrip.

Post your comment

Subject:
Message:
0/1000 characters