We use this vbs script file from Microsoft successfully called
metacleaner.vbs. I have attached the file called metacleaner.vbs.txt.
You need to rename it to metacleaner.vbs. Just type metacleaner at the
command prompt and it will show you the domain controllers it knows of.

Note the disclaimer at the beginning the file!

Mike H.


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mark Parris
Sent: Tuesday, July 05, 2005 11:19 AM
To: ActiveDir.org
Subject: Re: [ActiveDir] Can't get rid of old DC in Sites and Services

That's a a bit like using invisible paint, you can't see it but it's
still there.



-----Original Message-----
From: "Za Vue" <[EMAIL PROTECTED]>
Date: Tue, 5 Jul 2005 13:49:37
To:<[email protected]>
Subject: RE: [ActiveDir] Can't get rid of old DC in Sites and Services

I find that ADSI.MMC works best. Right click and delete. 
 
-Z.V.
 
 From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mark Orlando
Sent: Tuesday, July 05, 2005 10:14 AM
To: Active Directory Mailing List
Subject: Re: [ActiveDir] Can't get rid of old DC in Sites and Services

 
I will give it a shot.

Thanks,
Mark


On 6/29/05 12:19 PM, "Almeida Pinto, Jorge de"
<[EMAIL PROTECTED]> wrote:

 Do a metadata cleanup
 
See   Q216498
 
Cheers,
#JORGE#
 
   
       
From:   [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]   On Behalf Of Mark Orlando
Sent: woensdag 29 juni 2005   17:58
To: Active Directory Mailing List
Subject:   [ActiveDir] Can't get rid of old DC in Sites and   Services

I have a DC, which used to have all FISMO roles, that   is causing me
grief.
The server had issues so I put the roles on another DC   and demoted it
to a
member server.  I then deleted all of the static   site links that I had
set
up and let AD configure them automatically.    It has been working fine
for a
while, but now, for some reason, this   server is still being seen as a
DC
because some of the other DC=B9s are   still trying to replicate with
it.  I
went into Sites and Services and   deleted the links, but it won=B9t
actually
let me deleted the server   container for that DC that isn=B9t a DC
anymore.  I=
t
says it   can=B9t delete the DSA object.  How the heck do I get rid of
this   DC
in AD once and for all.

Thanks,
Mark Orlando
IT   Dept.
Linden Public Schools



This e-mail and any attachment is   for authorised use by the intended
recipient(s) only. It may contain   proprietary material, confidential
information and/or be subject to legal   privilege. It should not be
copied, disclosed to, retained or used by, any   other party. If you are
not an intended recipient then please promptly delete   this e-mail and
any attachment and all copies and inform the sender. Thank   you.



List info   : http://www.activedir.org/List.aspx
List FAQ    : http://www.activedir.org/ListFAQ.aspx
List archive:
http://www.mail-archive.com/activedir%40mail.activedir.org/


This communication and any documents, files, or previous e-mail messages 
attached to it constitute an electronic communication within the scope of the 
Electronic Communication Privacy Act, 18 USCA 2510.  This communication may 
contain non-public, confidential, or legally privileged information intended 
for the sole use of the designated recipient(s).  The unlawful interception, 
use or disclosure of such information is strictly prohibited under 18 USCA 2511 
and any applicable laws.
REM    ==========================================================
REM                GUI Metadata Cleanup Utility
REM             Written By Clay Perrine - [EMAIL PROTECTED]
REM                          Version 2.1
REM    ==========================================================
REM     This tool is furnished "AS IS". NO warranty is expressed or Implied.


on error resume next
dim 
objRoot,oDC,sPath,outval,oDCSelect,objConfiguration,objContainer,errval,ODCPath,ckdcPath,myObj
set objRoot=GetObject("LDAP://RootDSE")
sPath = "LDAP://OU=Domain Controllers," & objRoot.Get("defaultNamingContext")
Set objConfiguration = GetObject(sPath)
For Each objContainer in objConfiguration
outval = outval & vbtab &  objContainer.Name & VBCRLF
Next
outval = Replace(outval, "CN=", "")
oDCSelect= InputBox (outval,"Type the Name of the Problem Domain Controller","")
sPath = "LDAP://OU=Domain Controllers," & objRoot.Get("defaultNamingContext")
Set objConfiguration = GetObject(sPath)
For Each objContainer in objConfiguration
Err.Clear
ckdcPath = "LDAP://" & "CN=" & oDCSelect & ",OU=Domain Controllers," & 
objRoot.Get("defaultNamingContext")
set myObj=GetObject(ckdcPath)
If err.number <>0 Then
errval= 1
End If
Next
If errval = 1 then
msgbox "The Domain Controller you entered was not found in the Active 
Directory",,"Metadata Cleanup Utility Error."
wscript.quit
End If
abort = msgbox ("You are about to remove all metadata for the server " & 
oDCSelect & "! Are you sure?",4404,"WARNING!!")
if abort <> 6 then
msgbox "Metadata Cleanup Aborted.",,"Metadata Cleanup Utility Error."
wscript.quit
end if
oDCSelect = "CN=" & oDCSelect
ODCPath ="LDAP://" & oDCselect & ",OU=Domain Controllers," & 
objRoot.Get("defaultNamingContext")
sSitelist = "LDAP://CN=Sites,CN=Configuration," & 
objRoot.Get("defaultNamingContext")
Set objConfiguration = GetObject(sSitelist)
For Each objContainer in objConfiguration
Err.Clear
sitePath = "LDAP://" & oDCSelect & ",CN=Servers," &  objContainer.Name & 
",CN=Sites,CN=Configuration," & objRoot.Get("defaultNamingContext")
set myObj=GetObject(sitePath)
If err.number = 0 Then
siteval = sitePath
End If  
Next
sFRSSysvolList = "LDAP://CN=Domain System Volume (SYSVOL share),CN=File 
Replication Service,CN=System," & objRoot.Get("defaultNamingContext")
Set objConfiguration = GetObject(sFRSSysvolList)
For Each objContainer in objConfiguration
Err.Clear
SYSVOLPath = "LDAP://" & oDCSelect & ",CN=Domain System Volume (SYSVOL 
share),CN=File Replication Service,CN=System," & 
objRoot.Get("defaultNamingContext")
set myObj=GetObject(SYSVOLPath)
If err.number = 0 Then
SYSVOLval = SYSVOLPath
End If
Next
SiteList = Replace(sSitelist, "LDAP://", "")
VarSitelist = "LDAP://CN=Sites,CN=Configuration," & 
objRoot.Get("defaultNamingContext")
Set SiteConfiguration = GetObject(VarSitelist)
For Each SiteContainer in SiteConfiguration
Sitevar = SiteContainer.Name
VarPath ="LDAP://OU=Domain Controllers," & objRoot.Get("defaultNamingContext")
Set DCConfiguration = GetObject(VarPath)
For Each DomContainer in DCConfiguration
DCVar = DomContainer.Name
strFromServer = ""
NTDSPATH =  DCVar & ",CN=Servers," & SiteVar & "," & SiteList
GuidPath = "LDAP://CN=NTDS Settings,"& NTDSPATH 
Set objCheck = GetObject(NTDSPATH)
For Each CheckContainer in objCheck
Err.Clear
set exists=GetObject("LDAP://" & NTDSPATH)
If err.number = 0 Then
Set oGuidGet = GetObject(GuidPath)
For Each objContainer in oGuidGet
oGuid = objContainer.Name
oGuidPath = "LDAP://" & oGuid & ",CN=NTDS Settings," & NTDSPATH  
Set objSitelink = GetObject(oGuidPath)
objSiteLink.GetInfo
strFromServer = objSiteLink.Get("fromServer")
ispresent = Instr(1,strFromServer,oDCSelect,1)
if ispresent <> 0 then
Set objReplLinkVal = GetObject(oGuidPath)
objReplLinkVal.DeleteObject(0)
end if
next
End If
next
next
next
Set AccountObject = GetObject(ckdcPath)
temp=Accountobject.Get ("userAccountControl")
AccountObject.Put "userAccountControl", "4096"
AccountObject.SetInfo
Set objFRSSysvol = GetObject(SYSVOLval)
objFRSSysvol.DeleteObject(0)
Set objComputer = GetObject(ckdcPath)
objComputer.DeleteObject(0)
Set objConfig = GetObject(siteval)
objConfig.DeleteObject(0)
oDCSelect = Replace(oDCSelect, "CN=", "")
msgval = "Metadata Cleanup Completed for " & oDCSelect
msgbox  msgval,,"Notice."

Reply via email to