If I understand your question correctly, you may be able to accomplish this by creating a direct membership collection then performing a delete special on the collection.
Sorry for misanderstanding. My question was about a vbs script. I found this example:
'*******************************************************************************
'Name.............: Del_SMS_record.vbs
'Date.............: 04/05/02
'Author...........: Manohar Mathan
'Function.........: Deletes resource from Site Server
'Usage............: cscript Del_SMS_record.vbs computername
' OR
' Double click on script, it will prompt you for COmputerName
' Can be used in a 'FOR' statement to delete multiple computers.
'
'Please mail questions/Comments to mkannan15@yahoo.com
Dim loc
Dim oArgs
Dim strComputer, ResID
Dim strServer, strSiteCode
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'Edit the next two lines for your sitecode and siteserver
strServer = "SER2"
strSiteCode = "BSA"
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
If strServer = "ServerName" Then
WScript.Echo "Edit the script to enter ServerName and Site Code information"
WScript.Quit
End If
Set oArgs = WScript.Arguments
If oArgs.Count = 1 Then
strComputer = oArgs(0)
Else
strComputer = InputBox("Enter the Computer Name to be deleted from SMS:", _
"Computer Name", strComputer)
End If
Set loc = CreateObject( "WbemScripting.SWbemLocator" )
Dim WbemServices1
Set WbemServices1 = loc.ConnectServer( strServer,"root\SMS\site_" & strSiteCode)
ResID = getResID(strComputer, WbemServices1)
If ResID = Empty Then
WScript.Echo "Could not get ResourceID for " & strComputer
End If
WScript.Echo strComputer & " ResourceID in ALBSMSPRI01 is " & ResID
Set sResource = WbemServices1.Get("SMS_R_System='" & ResID & "'"
sResource.Delete_ 'Delete the resource
If Err = 0 Then
WScript.Echo strComputer & " deleted from ALBSMSPRI01"
Else
WScript.Echo strComputer & " COULD NOT BE deleted from " & strServer
End If
Set sResource = NOTHING
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Function GetResID(strComputer, oWbem)
Dim strQry
strQry = "Select ResourceID from SMS_R_System where Name=" & "'" & strComputer & "'"
Set objEnumerator = oWbem.ExecQuery(strQry)
If Err <> 0 Then
GetResID = 0
WScript.Echo "error Getting ResourceID of " & strComputer
Exit Function
End If
For Each objInstance in objEnumerator
For Each oProp in objInstance.Properties_
GetResID = oProp.Value
WScript.Echo "Resource ID of " & strCOmputer & " is " & oProp.Value
Next
Next
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.