7 users responded in this post

Subscribe to this post comment rss or trackback url
User Gravatar
Sachin said in January 23rd, 2011 at 8:12 pm

Hi,

I did steps as you mentioned , but computer not deleted after “successful” reimage.

Kindly advice …

Regards

VA:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
User Gravatar
danovich said in January 24th, 2011 at 1:21 pm

Do you see a success event 11171 in your logs?

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
User Gravatar
Sachin said in January 25th, 2011 at 2:57 am

Thanks for reply..

Yes I can see message id 11171 sent by component – Task Sequence Manager.

Regards

VA:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
User Gravatar
Sachin said in January 27th, 2011 at 10:05 am

Hi,

issue fixed…

http://social.technet.microsoft.com/Forums/en-US/configmgrsdk/thread/9205e49b-9d0e-462e-8998-87e6c31f9c41

Many Thanks

VA:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
User Gravatar
danovich said in March 8th, 2011 at 7:48 am

Just type in Task Sequence Manager manually, it will still work. It seems that some installations will list this component in the drop down box and others will not.

Here are some links to updated scripts that will do multiple collections and complex checks –

http://ccmexec.com/?paged=7

http://social.technet.microsoft.com/Forums/en-US/configmgrsdk/thread/9205e49b-9d0e-462e-8998-87e6c31f9c41

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
User Gravatar
danovich said in February 29th, 2012 at 2:42 pm

I would also recommending using Jörgen’s updated script from here – http://ccmexec.com/2010/03/remove-a-computer-from-a-collections-when-osd-task-sequence-is-completed/ . Personally on top of that, and as some comments recommend, I remove ‘and Obsolete = 0′ from line 49, so it looks something like:

Option Explicit
‘ Constants for type of event log entry
const EVENTLOG_INFORMATION = 4

Dim Args
Dim swbemLocator, SWbemServices, objCollection, oProviderLocation, oLocation
Dim strComputerName, arrComputers, objComputer, sCollectionIDs
Dim objDirectRule
Dim strmessage, objshell
Dim seventlog, sClearPxeflag

On Error Resume Next

‘CollectionIDs from which to remove the computer
‘Should an eventlog entry be generated, set Seventlog=1

sEventlog = “1″
sCollectionIDs = “xxx000FC:xxx000FE:xxx000FB:xxx000FD”

‘————————————————————
‘Get Command Line arguments

Set args = WScript.Arguments
strComputername = args.Item(0)

If strComputerName = NULL then
wscript.quit
End if

‘————————————————————
‘Main script

set objShell = CreateObject(“WScript.Shell”)

Set swbemLocator = CreateObject(“WbemScripting.SWbemLocator”)
swbemLocator.Security_.AuthenticationLevel = 6 ‘Packet Privacy.
Set swbemServices = swbemLocator.ConnectServer(“.”, “root\SMS”)
Set oProviderLocation = swbemServices.InstancesOf(“SMS_ProviderLocation”)
For Each oLocation In oProviderLocation
If oLocation.ProviderForLocalSite = True Then
Set swbemServices = swbemLocator.ConnectServer(oLocation.Machine, “root\sms\site_” + oLocation.SiteCode)
End If
Next

Set arrComputers = SWbemServices.ExecQuery(“select * from SMS_R_System where Name=’” & strComputerName & “‘”)

For Each objComputer In arrComputers
RemoveCollectionMembership objComputer.ResourceID

‘Write to eventlog if Seventlog = 1
If Seventlog = “1″ then
strMessage = strcomputername & ” will be removed from the following collection ID’s ” & scollectionids
objShell.LogEvent EVENTLOG_INFORMATION, strMessage
End IF

Next

Set objCollection = Nothing
Set SWbemServices = Nothing
Set SWbemLocator = Nothing

Wscript.Quit

‘————————————————
Sub RemoveCollectionMembership(intresourceid)
on error resume next

Dim mCollectionID, i
mCollectionID = Split (sCollectionIDs, “:”)
for i = Lbound(mCollectionID) to UBound(mCollectionID)

Set objCollection = SWbemServices.Get(“SMS_Collection=’” & MCollectionID(i) & “‘”)
Set ObjDirectRule = SWbemServices.Get(“SMS_CollectionRuleDirect”).SpawnInstance_
ObjDirectRule.ResourceID = intresourceid
ObjCollection.DeleteMembershipRule objDirectRule
next
End Sub

‘————————————————

WScript.Quit(0)

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
User Gravatar
faulknerp said in June 25th, 2012 at 4:43 pm

This looks exactly like what I need! However I can’t quite seem to get it to work.

I am getting an event log entry written by the status filter rule when a system completes a task sequences (with component “UNKNOWN COMPONENT”) but the object is still in the collection. When I run the script manually it removes it correctly. Has anyone got any ideas please?

VA:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
Leave A Reply

 Username (Required)

 Email Address (Remains Private)

 Website (Optional)