Collection query based on a machine being a member of another collection

Earlier today I was trying to create a collection that showed all machines that were in another collection.

This has to be done using a sub select query and the first one I used brought back all machines that were in a collection, based on that collection ID:

select SMS_R_SYSTEM.ResourceID, SMS_R_SYSTEM.ResourceType, SMS_R_SYSTEM.Name, SMS_R_SYSTEM.SMSUniqueIdentifier, SMS_R_SYSTEM.ResourceDomainORWorkgroup, SMS_R_SYSTEM.Client from SMS_R_System where ResourceID in
(select ResourceID
from SMS_FullCollectionMembership
where CollectionID = “NOV00062”)

Unfortunately this only partly solved the clients problem, as he wanted to bring back all machines that were part of a collection where the collection name started with “Lab:”. This meant adding a join to the query, as the SMS_FullCollectionMembership table doesn’t include the collection name, only the collection ID:

select SMS_R_SYSTEM.ResourceID, SMS_R_SYSTEM.ResourceType, SMS_R_SYSTEM.Name, SMS_R_SYSTEM.SMSUniqueIdentifier, SMS_R_SYSTEM.ResourceDomainORWorkgroup, SMS_R_SYSTEM.Client from SMS_R_System where SMS_R_System.ResourceId in
(select ResourceID  
from SMS_FullCollectionMembership  
JOIN SMS_Collection on SMS_FullCollectionMembership.CollectionID = SMS_Collection.CollectionID
where SMS_Collection.name LIKE “Lab:%”)

Problem solved 🙂

Advertisements

Restart notification behaviour for software and patch deployments

Quite some time ago I had the need to document the restart notification behaviour of normal software deployments, software deployments within a task sequence and patch deployments. I wrote it all up in a draft blog post but never actually published it…..well here it is!

The reason I originally researched this is because we had a number of important users who got different restart notification messages depending on what they were installing and this became quite confusing! If they installed a patch they might get an 8 hour grace period before restarting but if they installed software (which unknown to them was done within a task sequence), they might get as little as 1 minute warning prior to a reboot.

It became important to document the behaviour, not just for our users, but our admins as well. Below are the results of the tests.

Normal Software Deployment and Patch Deployment

I’m sure most of you know that this is managed from the Computer Client Agent Properties under the Restart tab. The first option being the initial countdown, in minutes, once the patch or software has installed and a reboot is required and the second option being the number of minutes, prior to the forced reboot, a final notification will be shown to the user.

CCAProps

Software Deployment via Task Sequence

Things become a little more complex when you start using task sequences to deploy software and that’s because the above options no longer apply.

There are normally 2 reason why a reboot would take place during a running task sequence – when an application, that is being installed as part of an Install Software task sequence step, returns a 3010 exit code or when you specifically use a Restart Computer task sequence step.

If the reboot occurs due to the 3010 exit code, there will only be a 1 minute warning prior to the machine being force rebooted. I’ve not checked too intensely but I’m not sure if there is any way to change this setting, except to suppress the 3010 code in a script and do a controlled reboot using the Restart Computer task sequence step, mentioned below.

If the reboot occurs due to the use of the Restart Computer task sequence step, you are able to specify exactly how many seconds the notification message will be shown to the user before the machine is rebooted, in the step itself. The default is only 60 seconds and the max is 9999 seconds (about 2 and a half hours).

RCTSStep

It is also possible to increase the value to above 9999 seconds, if required, by using a task sequence variable called SMSRebootTimeout. You simply need to add the Set Task Sequence Variable step to the start of your task sequence, use the SMSRebootTimeout variable and set a value in seconds. This then overwrites whatever number is used in the Restart Computer task.

Below shows me increasing the timeout to 8 hours:

TSVar

TSNotification

If you want this restart value to apply to all task sequences that use the Restart Computer step, without manually changing each task sequence, you can also do this by adding the variable into the Collection Variables tab, under the Modify Collection Settings option on any collection. This will ensure that any machine in that collection, running a task sequence, will adhere to the value in the variable. If you need to overwrite the top level collection variable, you can also do this by adding the variable directly into the task sequence again and it should do so.

CollVar

Hope that helps
Nik