Duplication entries in Manager Console Collections
Hi,
One of our client office we have deployed SCCM2007R2 and things are going fine now. In Manager console, client systems that are discovered by SCCM site appears along with that there are some duplication entries are also seen.
The duplication entries are the client system that are discovered by SCCM site even after the clients are removed\crashed the entry is there. Can anyone suggest me is there any way to delete these entries automatically.
note : there i found an option to delete the absolute after a certain time period, but i want it to be deleted immediately when it is removed from AD.
with Thanks, Lokesh
July 27th, 2010 8:08am
Hi,
There is no built-in feature to delete the resource from SCCM right after you have deleted the resource in AD. What you can do is create a script the deletes the resource in both
databases (AD and SCCM) or create some collections where you can list those computers that haven't logged in for x-number of days (last one can be a little dangerous).
Kent Agerlund | http://scug.dk/members/Agerlund/default.aspx | The Danish community for System Center products
Free Windows Admin Tool Kit Click here and download it now
July 27th, 2010 11:04am
Hi Kent!
May be I don't right, but if I installed ConfigMgr 2007 ToolKit V2 and right click by the dublicate in collection I can delete this record from DB.
That is not automatic solution.
July 27th, 2010 2:02pm
Which tool from the toolkit are you referring to? I am not aware that you would need the toolkit to delete a resource from the database.
Free Windows Admin Tool Kit Click here and download it now
July 27th, 2010 2:17pm
Hi Torsten.
Please, could you see the printscreen - http://i056.radikal.ru/1007/21/0f2d211858c9.jpg (radikal.ru is freedom file resource)
July 27th, 2010 2:42pm
Oh, sorry. I understood my mistake.
It is heat - we all cannot think in Moscow.
I am very sorry.
Free Windows Admin Tool Kit Click here and download it now
July 27th, 2010 3:03pm
Thanks Kent, i have deleted the entries manually and scheduled for the removal of absolute clients.
with Thanks, Lokesh
July 29th, 2010 1:08pm
Hi all,
You can use this script to delete the clients systems from sql database
* Filter the client systems which wants to be deleted deom sms/sccm database
* Create a notepad for injecting computer name as INPUT
strSMSServer = " SERVER_NAME"
strSMSSiteCode = "SMS_SITE_CODE"
Set objFSO = CreateObject("Scripting.FileSystemObject")
If not objFSO.FileExists("C:\computer_lists\sms_deletion.txt") Then
WScript.Quit(99)
End If
Set ObjStream = objFSO.OpenTextFile("C:\computer_lists\sms_deletion.txt",1)
Set objLoc = CreateObject("WbemScripting.SWbemLocator")
Set objSMS= objLoc.ConnectServer(strSMSServer, "root\sms")
Set Results = objSMS.ExecQuery _
("SELECT * From SMS_ProviderLocation WHERE ProviderForLocalSite = true")
For each Loc in Results
If Loc.ProviderForLocalSite = True Then
Set objSMS = objLoc.ConnectServer(Loc.Machine, "root\sms\site_" & _
Loc.SiteCode)
strSMSSiteCode = Loc.SiteCode
end If
Next
Do While Not ObjStream.AtEndOfStream
strComputer = ObjStream.ReadLine
' strComputer shouldn't be blank, if it is, there is something wrong with the input file.
If strComputer = "" Then
WScript.Quit
End If
'get the resource ID of the computer
bIsInSMS = False
intResourceID = GetResourceID(strComputer,bIsInSMS)
' we check to see if the computer is "pingable".
' If it is, then perhaps we shouldn't be deleting it.
If Not Reachable(strComputer) Then
If bIsInSMS Then
On Error Resume Next
Set objResource = GetObject( "WinMgmts:\\" & strSMSServer & _
"\root\SMS\site_" & strSMSSiteCode & _
":SMS_R_System.ResourceID=" & cstr(intResourceID))
' don't try and delete the computer if we couldn't get a handle to it.
If Err.Number <> 0 Then
wscript.echo "An SMS error occurred: " + Err.Description + " (" + cstr(Err.Number) + ") "& strComputer
else
objResource.Delete_
wscript.echo "Deleted " & strComputer & "(" & intResourceID & ")"
WScript.sleep 5000
End If
On Error GoTo 0
Else
wscript.echo "Not Found in SMS: " & strComputer
End If
Else
wscript.echo "This machine is alive: " & strComputer
End If
On Error GoTo 0
Loop
WScript.Quit
Function GetResourceID(strComputerName,bFoundInSms)
bFoundInSms = False
Set colResourceIDs = objSMS.ExecQuery _
("select ResourceID from SMS_R_System where Name = '" & _
strComputer & "'")
for Each objResID in colResourceIDs
GetResourceID = objResID.ResourceID
bFoundInSms = True
Next
End Function
Function Reachable(strComputer)
' On Error Resume Next
Dim wmiQuery, objWMIService, objPing, objStatus
wmiQuery = "Select * From Win32_PingStatus Where Address = '" & strComputer & "'"
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set objPing = objWMIService.ExecQuery(wmiQuery)
For Each objStatus In objPing
If IsNull(objStatus.StatusCode) Or objStatus.Statuscode<>0 Then
Reachable = False 'if computer is unreacable, return false
Else
Reachable = True 'if computer is reachable, return true
End If
Next
End Function
* Tested in Lab Environment only *
with Thanks, Lokesh
Free Windows Admin Tool Kit Click here and download it now
October 19th, 2010 3:28pm


