Jump to content


  • 0
Tobie

Automatic removal of applications

Question

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:

 

  • 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.

post-2397-1234113828_thumb.jpg

 

Give your collection a name, mine is Microsoft Virtual PC 2007 SP1 Eng, press Next.

post-2397-1234114008_thumb.jpg

 

Press on Query Rule to create a query that will be connected to our Active Directory Security Group that we created erlier.

post-2397-1234114188_thumb.jpg

 

Give your query a name, press on Edit Query Statement to create a query.

post-2397-1234114366_thumb.jpg

 

Press on Show Query Language to enter the query.

post-2397-1234114550_thumb.jpg

 

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.

post-2397-1234114754_thumb.jpg

 

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.

post-2397-1234115273_thumb.jpg

 

Press on Schedule to change values of how often the collection will be updated automatically.

post-2397-1234115458_thumb.jpg

 

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.

post-2397-1234115695_thumb.jpg

 

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.

post-2397-1234115995_thumb.jpg

 

 

 

Create Subcollections

 

Here is the structure of the "Parent Collection" and "Sub Collection".

post-2397-1234121945_thumb.jpg

 

Right click on your newly created collection and choose New, Collection. Name it to All who has %Collection ID% and press Next.

post-2397-1234116489_thumb.jpg

 

Press on Query Rule to create a query that will collect computers that has a spicific software registered in Add or Remove Programs.

post-2397-1234114188_thumb.jpg

 

Give your query a name, press on Edit Query Statement to create a query.

post-2397-1234116747_thumb.jpg

 

Press on Show Query Language to enter the query.

post-2397-1234117027_thumb.jpg

 

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..

post-2397-1234117363_thumb.jpg

 

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.

post-2397-1234117964_thumb.jpg

 

Expand %COMPUTERNAME%, Resource Explorer, Hardware, Add/Remove Programs. Here is your Product ID's :).

post-2397-1234118353_thumb.jpg

 

Press on Schedule to change values of how often the collection will be updated automatically.

post-2397-1234118779_thumb.jpg

 

I will use the same value as my first collection. Make your changes and press OK.

post-2397-1234115695_thumb.jpg

 

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.

post-2397-1234120297_thumb.jpg

 

Choose the parent collection and press OK.

post-2397-1234120446_thumb.jpg

 

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.

post-2397-1234120297_thumb.jpg

 

Choose All who has %Collection ID% and press OK.

post-2397-1234121454_thumb.jpg

 

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.

 

Fallow this post please!

Extend "All advertisement for a specific computer" with latest runtime.

post-2397-1234112672_thumb.jpg

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

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.