<$BlogRSDUrl$>

Monday, March 01, 2004

Remove a computer from a domain 

Here's a function to remove a computer from a domain. We're using it as part of a massive clean up effort.
'----------------------------------------+----------------------------------------
' RemoveComputer - Removes a computer from a domain
'
' Date   Name    Comment
' ------ ------- -----------------------------------------------------------------
' 040227 CGL     Created
'----------------------------------------+----------------------------------------
Function RemoveComputer( strDomain, strComputer )
  Dim objDC
  On error resume next
  Set objDC = getobject("WinNT://" & strDomain )
  objDC.Delete "Computer", strComputer
  if err = 0 Then
    RemoveComputer = true
  else
    RemoveComputer = false
  end if
  On error goto 0
End function
Copyright © 2003, Christopher G. Lewis
|

This page is powered by Blogger. Isn't yours? Weblog Commenting and Trackback by HaloScan.com