Status Filter Rules not applying ?
Hello, I am using OSD to deploy Windows and created the 2 following Status Filter Rules : One that will send me an email via SMTP when a Task Sequence fails. It is triggered by Message ID # 11170 and will run a VBSscript that will send me a notifcation email... One that will automatically delete a computer from the Deployment collection after being imaged. It is triggered by Message ID # 11171 and runs a VBScript that deletes the computer object from the collection ID. Both rules are on the top of the list of priorities and have « Report to the event log » checked. The first rule works fine. The second rule doesn't seem to work. If I run it manually, it works fine so it is not a script issue. I even get an eventlog entry saying that computer X will be deleted from collection Y and gets deleted. I check in the event log and when a computer is imaged, I see a message with ID 11171, meaning that the Task Sequence was successful but for some reason, that rule doesn't seem to apply (this rule is on the top of all the rules!) Any idea on what/where I could check to know why it is not running? (I double checked the message ID, no typo there...) Thanks for the help!
July 26th, 2011 3:42pm

I just saw someone else doing something similar last week. This guy is actually adding a script into the TS to handle sending the emails. He said it works well. I'll try to dig up that post. John Marcum | http://myitforum.com/cs2/blogs/jmarcum/|
Free Windows Admin Tool Kit Click here and download it now
July 26th, 2011 4:07pm

John, are you talking about this post http://blog.danovich.com.au/2010/03/12/send-sccm-task-sequence-email-report/Bechir Gharbi | http://myitforum.com/cs2/blogs/bgharbi/ | Time zone : GMT+1
July 26th, 2011 4:22pm

The one I saw was on the myitforum.com SMS mailing list. I posted there and several people replied. I pointed them here. The one I saw added a script right into the TS. The script sent customized emails depending upon whether the TS failed or succeded. John Marcum | http://myitforum.com/cs2/blogs/jmarcum/|
Free Windows Admin Tool Kit Click here and download it now
July 26th, 2011 4:49pm

Johan blogged about doing this via MDT which can easily be done as well without MDT Integration just add the ZTIUtility.vbs script to your package and call the referenced script. http://www.deploymentresearch.com/Blog/tabid/62/EntryId/19/Configure-MDT-2010-to-send-an-email-when-deployment-is-completed.aspx Thanks, BrandonBrandon Linton |http://myitforum.com/cs2/blogs/brandonlinton/default.aspx | MCTS - SCCM, MDT, AD
July 26th, 2011 5:35pm

In my TS's I have a group called "Gather Logs and StateStore on Failure" Inside that group I perform a few tasks such as remoning the comptuer from the collection, clearing the last PXE advertisement and copying the deployment logs up to a share. All of those same actions are also performed in the State Restore group for successful deployments. It would be easy to use the steps outlined in Johans blog to send one type email for success and a different email for failures. Just place the send mail step in each of those groups. John Marcum | http://myitforum.com/cs2/blogs/jmarcum/|
Free Windows Admin Tool Kit Click here and download it now
July 27th, 2011 8:09am

Actually the problem is not about sending emails, this rule works It is the one that is supposed to delete computers from the collection after they have been imaged? I see in the server logs that I imaged 3 laptops this morning and they have a 11171 entry in the event log saying that the Task Sequence completed successfully. But the status filter rules never triggered ? If I run it manually from the server for one computer, it gets deleted. It is just that, for some reason, that rule doesnt seem to get triggered while the other rule (the one that sends email) is working? When a computer is imaged, a 11171 entry gets added to the eventlog but the rule associated with this entry never starts ? Any idea on what I could check on the server to find why this one is not running???
July 27th, 2011 2:41pm

Hi, When you "run it by hand" you are running it with your credentials, right? What happens if you run the vbscript under the SYSTEM context? Have a look at this blog: http://blog.danovich.com.au/2010/03/12/remove-computer-association-from-collection-after-sccm-task-sequence/ it gives us a working script and status filter rule definition on event 11171. Also take this as a reference: http://technet.microsoft.com/en-us/library/bb693758.aspx Command-Line Parameters for Status Filter Rules. Hope this will help. Thanks
Free Windows Admin Tool Kit Click here and download it now
July 28th, 2011 3:36am

I opened a cmd in Local System Context and ran the script manually and it worked...but again, it never gets triggered when an event 11171 is generated, while the send email, for 11170 works?
July 29th, 2011 8:43am

I opened a cmd in Local System Context and ran the script manually and it worked...but again, it never gets triggered when an event 11171 is generated, while the send email, for 11170 works? replace the mail script on the failure rule with something that can easily run, or report to the event log, do they fail to trigger correctly too?
Free Windows Admin Tool Kit Click here and download it now
July 30th, 2011 3:23pm

Hmmm very weird. The script that sends an email when an error occurs (Event ID 11170) works perfectly and every time. I copied this script (changed subject and description...) and assigned this to the status filter rules of a TS success (Event ID 11171) and it worked one time / 5 ? As you can see in the image joined, a successfull TS completed at 1:49:58 and 2 seconds later, the script ran. Then, 3 other successful TS were at 1:55, 1:57 and 1:58 but nothing got triggered ? Could it be that there are too many things running on the server and sometimes, the Status Filter rule doesn't run because the server is too busy running other stuff? (this Status Filter Rule is the first one on the top of the priorities...)...One thing though is that I know that hte script is working :) It just doesn't get triggered every time a 11171 event ID is generated :(
August 5th, 2011 9:18pm

OK I found something interesting...it actually works for computers that already exist in SCCM (ie: If I select a computer from the the All Systems collection and add it to my Deployment collection, the script will run and the computer will get deleted) It doesn't run for computers that have been imported (computers that are fresh out of the box from the manufacturer, that never been connected to our network). Here's the script I run 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 'Should an eventlog entry be generated, set Seventlog=1 sEventlog = "1" 'CollectionIDs from which to remove the computer sCollectionIDs = "AAA00173" '------------------------------------------------------------ 'Get Command Line arguments Set args = WScript.Arguments strComputername = args.Item(0) If strComputerName = NULL then If Seventlog = "1" then strMessage = "Computer name seems to be null..." objShell.LogEvent EVENTLOG_INFORMATION, strMessage End IF 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 & "' and Obsolete = 0") If Seventlog = "1" then strMessage = "Status Filter rule script ran" objShell.LogEvent EVENTLOG_INFORMATION, strMessage End IF 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) After checking back the script, I think the problem would be in that command Set arrComputers = SWbemServices.ExecQuery("select * from SMS_R_System where Name='" & strComputerName & "' and Obsolete = 0") So I added a simple entry to the event viewre ("Status filter ran") and it's there, but it doesn't seem to enter in the For right after ... like arrComputers would be null ? Could it be possible that since I imported the computer, it doesn't exist in SMS_R_System. Is there a way I could check that ? Thanks!
Free Windows Admin Tool Kit Click here and download it now
August 10th, 2011 1:16pm

OK I found something interesting...it actually works for computers that already exist in SCCM (ie: If I select a computer from the the All Systems collection and add it to my Deployment collection, the script will run and the computer will get deleted) It doesn't run for computers that have been imported (computers that are fresh out of the box from the manufacturer, that never been connected to our network). After checking back the script, I think the problem would be in that command Set arrComputers = SWbemServices.ExecQuery("select * from SMS_R_System where Name='" & strComputerName & "' and Obsolete = 0") Could it be possible that since I imported the computer, it doesn't exist in SMS_R_System. Is there a way I could check that ? Thanks! I think it is there, try this wql query instead: select * from sms_r_system where name="<NAME>" and (obsolete = 0 or obsolete is null) That should help you select the client record. To check out sms_r_system, use WBEMTEST to connect to the site servers WMI namespace, click connect, root\sms\site_<YOUR SITE CODE>, click query, write a query and run it
August 10th, 2011 2:28pm

I think I got it now !!!! If I run this : select * from SMS_R_System where Name='" & strComputerName & "' and Obsolete = 0, I don't get any result If I run yours, then I get something SMS_R_System.ResourdeID so I'll try changing that in my script and I think it will be fine :) I will let you know!
Free Windows Admin Tool Kit Click here and download it now
August 10th, 2011 3:05pm

SMS Marshall was right, my query wasn't good ! After I added obsolete = 0 or obsolete is null (so the query is now : select * from sms_r_system where name="<NAME>" and (obsolete = 0 or obsolete is null)), then it started to delete existing and imported computers Many thanks!
August 10th, 2011 9:57pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics