Create collections that automatically activate the uninstall-advertisement for an application if the computer has been removed from the active directory application installation group. This is just for additional applications since this will mess up base applications that has been deployed during OSD or has been installed afterwards. This can be useful for those who wants to keep down licensing costs for expensive applications or collateral that applications is uninstalled for example when Service Desk staff removes the computer object from the application group.
NOTE: I will use Microsoft Virtual PC 2007 SP1 as a application in this guide.
Dependencies:
Hardware Inventory must be enabled
Active Directory Security Group is used for deploying applications
Patience
Create a Active Directory Security Group
Open Active Directory User and Computer.
Create a new group named APP_MS_Virtual_PC_2007_SP1_Eng. You can use which name and standard you want on your application group since I'm just using this application to create this guide.
Create Collections
Expand Site Database, Computer Management, Collections, right click and create a new collection.
Give your collection a name, mine is Microsoft Virtual PC 2007 SP1 Eng, press Next.
Press on Query Rule to create a query that will be connected to our Active Directory Security Group that we created erlier.
Give your query a name, press on Edit Query Statement to create a query.
Press on Show Query Language to enter the query.
Enter your WQL statement and press OK. Change DSG\\APP_MS_Virtual_PC_2007_SP1_Eng to your own DOMAIN\\APPLICATION_INSTALLATION_GROUP. This query will collect computers from the Active Directory Security Group that we created erlier, those computers that are members of this group will be placed in our collection as well.
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.SystemGroupName = "DSG\\APP_MS_Virtual_PC_2007_SP1_Eng"
Press OK to get back to the Create New Collection Wizard.
Press on Schedule to change values of how often the collection will be updated automatically.
I will use a low update value since I don't have many clients in my lab environment and the performance of my primary site server is pretty good. Make your changes and press OK.
Press Next in the Membership Rules section.
Press Next in the Advertisements section.
Press Next in the Security section.
Press Close to finish the wizard.
Right click on your newly created collection and choose Properties. Remember Collection ID.
Create Subcollections
Here is the structure of the "Parent Collection" and "Sub Collection".
Right click on your newly created collection and choose New, Collection. Name it to All who has %Collection ID% and press Next.
Press on Query Rule to create a query that will collect computers that has a spicific software registered in Add or Remove Programs.
Give your query a name, press on Edit Query Statement to create a query.
Press on Show Query Language to enter the query.
Enter your WQL statement and press OK. Change {23E8D2D6-F7C8-4A35-816C-6C914EE0A601} to your own {PRODUCT ID}. This query will collect computers that has this Product ID registered in Add or Remove Programs. Press OK twice to get back to the Wizard. Below, I will explain how you can gather information such like Product ID and stuff like that from your computers that are assigned to your Site..
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 inner join SMS_G_System_ADD_REMOVE_PROGRAMS on SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceID = SMS_R_System.ResourceId where SMS_G_System_ADD_REMOVE_PROGRAMS.ProdID = "{23E8D2D6-F7C8-4A35-816C-6C914EE0A601}" order by SMS_R_System.Name
Collect Product ID
In your Configuration Manage Console, Expand Site Database, Computer Management, Collections and select All Systems. Right click on a computer object where the application is installed and choose Start, Resource Explorer.
Expand %COMPUTERNAME%, Resource Explorer, Hardware, Add/Remove Programs. Here is your Product ID's .
Press on Schedule to change values of how often the collection will be updated automatically.
I will use the same value as my first collection. Make your changes and press OK.
Press Next in the Membership Rules section.
Press Next in the Advertisements section.
Press Next in the Security section.
Press Close to finish the wizard.
We need to create 2 more collections, let's starting with the second one and there it's just one more to go.
Create a new collection called These are missing %Collection ID%.
Don't forget to change the Product ID!
Membership Rules Query. This query will collect computer that should have the application but don't have it, well, that's a lie, the collection will collect computers that don't has it when we have linked this collection to it's parent collection. I will show you how to it below.
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 Name not in (select distinct SMS_R_System.Name from SMS_R_System inner join SMS_G_System_ADD_REMOVE_PROGRAMS on SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceID = SMS_R_System.ResourceId where SMS_G_System_ADD_REMOVE_PROGRAMS.ProdID = "{23E8D2D6-F7C8-4A35-816C-6C914EE0A601}") order by Name
When you have entered your WQL statement, press OK and then select Limit to collection and press Browse.
Choose the parent collection and press OK.
Press OK to continue.
Set the Update Schedule to 15 minutes and press Next.
Press Next in the Advertisements section.
Press Next in the Security section.
Press Close to finish the wizard.
Now, the last collection. Create a new collection called These should NOT have %Collection ID%.
Don't forget to change Collection ID!
Membership Rules Query. This query and limit together will watch after computers in the partent collection and verify if they computer should have the application or not. If it not should have the application (computer object has been removed from the application installation group), will trigger the uninstall-advertisement later. The last peace of the code is the Collection ID, that should be your parent connection.
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 not in (select ResourceId from SMS_CM_RES_COLL_DSG00036)
When you have entered your WQL statement, press OK and then select Limit to collection and press Browse.
Choose All who has %Collection ID% and press OK.
Press OK to continue.
Set the Update Schedule to 15 minutes and press Next.
Press Next in the Advertisements section.
Press Next in the Security section.
Press Close to finish the wizard.
Now, let's do the last thing, connect our advertisements to our new collections.
Connect your uninstall-advertisement to collection These should NOT have %Collection ID%.
Connect your install-advertisement to collection These are missing %Collection ID%.
Add a computer to your application installation group and let the application be installed on a computer, little later, remove the computer object from application installation group and watch the automatic process of how this application will be uninstalled.
I can tell you that my Hardware Invetory runs every 30 minutes on my computers in my lab environment.
Good luck!
Extend SMS Report to get out more if this concept.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.
Automatic removal of applications
Create collections that automatically activate the uninstall-advertisement for an application if the computer has been removed from the active directory application installation group. This is just for additional applications since this will mess up base applications that has been deployed during OSD or has been installed afterwards. This can be useful for those who wants to keep down licensing costs for expensive applications or collateral that applications is uninstalled for example when Service Desk staff removes the computer object from the application group.
NOTE: I will use Microsoft Virtual PC 2007 SP1 as a application in this guide.
Dependencies:
Create a Active Directory Security Group
Open Active Directory User and Computer.
Create a new group named APP_MS_Virtual_PC_2007_SP1_Eng. You can use which name and standard you want on your application group since I'm just using this application to create this guide.
Create Collections
Expand Site Database, Computer Management, Collections, right click and create a new collection.
Give your collection a name, mine is Microsoft Virtual PC 2007 SP1 Eng, press Next.
Press on Query Rule to create a query that will be connected to our Active Directory Security Group that we created erlier.
Give your query a name, press on Edit Query Statement to create a query.
Press on Show Query Language to enter the query.
Enter your WQL statement and press OK. Change DSG\\APP_MS_Virtual_PC_2007_SP1_Eng to your own DOMAIN\\APPLICATION_INSTALLATION_GROUP. This query will collect computers from the Active Directory Security Group that we created erlier, those computers that are members of this group will be placed in our collection as well.
Press OK to get back to the Create New Collection Wizard.
Press on Schedule to change values of how often the collection will be updated automatically.
I will use a low update value since I don't have many clients in my lab environment and the performance of my primary site server is pretty good. Make your changes and press OK.
Press Next in the Membership Rules section.
Press Next in the Advertisements section.
Press Next in the Security section.
Press Close to finish the wizard.
Right click on your newly created collection and choose Properties. Remember Collection ID.
Create Subcollections
Here is the structure of the "Parent Collection" and "Sub Collection".
Right click on your newly created collection and choose New, Collection. Name it to All who has %Collection ID% and press Next.
Press on Query Rule to create a query that will collect computers that has a spicific software registered in Add or Remove Programs.
Give your query a name, press on Edit Query Statement to create a query.
Press on Show Query Language to enter the query.
Enter your WQL statement and press OK. Change {23E8D2D6-F7C8-4A35-816C-6C914EE0A601} to your own {PRODUCT ID}. This query will collect computers that has this Product ID registered in Add or Remove Programs. Press OK twice to get back to the Wizard. Below, I will explain how you can gather information such like Product ID and stuff like that from your computers that are assigned to your Site..
Press on Schedule to change values of how often the collection will be updated automatically.
I will use the same value as my first collection. Make your changes and press OK.
Press Next in the Membership Rules section.
Press Next in the Advertisements section.
Press Next in the Security section.
Press Close to finish the wizard.
We need to create 2 more collections, let's starting with the second one and there it's just one more to go.
Create a new collection called These are missing %Collection ID%.
Don't forget to change the Product ID!
Membership Rules Query. This query will collect computer that should have the application but don't have it, well, that's a lie, the collection will collect computers that don't has it when we have linked this collection to it's parent collection. I will show you how to it below.
When you have entered your WQL statement, press OK and then select Limit to collection and press Browse.
Choose the parent collection and press OK.
Press OK to continue.
Set the Update Schedule to 15 minutes and press Next.
Press Next in the Advertisements section.
Press Next in the Security section.
Press Close to finish the wizard.
Now, the last collection. Create a new collection called These should NOT have %Collection ID%.
Don't forget to change Collection ID!
Membership Rules Query. This query and limit together will watch after computers in the partent collection and verify if they computer should have the application or not. If it not should have the application (computer object has been removed from the application installation group), will trigger the uninstall-advertisement later. The last peace of the code is the Collection ID, that should be your parent connection.
When you have entered your WQL statement, press OK and then select Limit to collection and press Browse.
Choose All who has %Collection ID% and press OK.
Press OK to continue.
Set the Update Schedule to 15 minutes and press Next.
Press Next in the Advertisements section.
Press Next in the Security section.
Press Close to finish the wizard.
Now, let's do the last thing, connect our advertisements to our new collections.
Connect your uninstall-advertisement to collection These should NOT have %Collection ID%.
Connect your install-advertisement to collection These are missing %Collection ID%.
Add a computer to your application installation group and let the application be installed on a computer, little later, remove the computer object from application installation group and watch the automatic process of how this application will be uninstalled.
I can tell you that my Hardware Invetory runs every 30 minutes on my computers in my lab environment.
Good luck!
Share this post
Link to post
Share on other sites