none
powershell or wmi command to remove stale deployments from clients?

    Question


  • hello,
    we have a dynamic collection containing computer objects, with an "uninstall application" deployment targeted to it. computers are added and removed from that collection on certain criteria, when they are inside the app gets uninstalled, otherwise not. mostly this works fine.

    we now have one computer with the following issue:
    - 4 month ago, it has received the uninstall deployment, because it was in this collection
    - it tried to run it, but failed (local msi issue)
    - it kept retrying the uninstallation several times in the past month, always failing.
    - the computer eventually was removed from the collection, therefore no longer receiving the uninstall deployment.
    - still, in software center the deployment shows up with status "retrying".

    appenforce.log lists this entry countless times:

    +++ Starting Uninstall enforcement for App DT "application name" ApplicationDeliveryType - ScopeId_GUID/Deployment.....

    we have verified server-side that the computer does not receive the uninstall deployment any longer - in properties of the computer object it is definitely gone. still, the client doesn't let go of the uninstall deployment, retrying it in a loop.


    my question now is actually not how to prevent this from happening. i have already learned that sccm simply does these kinds of things for no reason. rather i'd like to know if there is any way that i can remove the invalid deployment information from the client? i'd like to avoid a "wmi reset" and prefer to just trash the particular incorrect entry.

    is there a powershell or WMI command to
    a) see a list of deployments targeted to the local client?
    b) delete specific deployments from wmi of the local client?

    if this is not easily possible, is there a way to
    c) reset all deployments (on the client side) targeted to the local client?

    Wednesday, April 29, 2015 6:34 PM

All replies

  • Hi,

    To remove the advertisement from wmi you can try this command:

     gwmi -Namespace root\sccmdp -Query "select * from SMS_PackagesInContLib where PackageID = 'XXX00043'" | Remove-WmiObject

    https://social.technet.microsoft.com/Forums/en-US/8328f9ce-d290-4aba-8187-670080464476/sccm-2012-how-to-delete-packages-from-wmi


    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Thursday, April 30, 2015 5:36 AM
    Moderator
  • i need to do this on a client. this looks like a command for the distribution doint, namespace sccmdp is not available on the client

    gwmi -Namespace root\sccmdp


    • Edited by RR Med Thursday, April 30, 2015 6:01 AM
    Thursday, April 30, 2015 5:53 AM

  •  gwmi -Namespace root\sccmdp -Query "select * from SMS_PackagesInContLib where PackageID = 'XXX00043'" | Remove-WmiObject


    This is ditribution point related and has nothing to do with the client.

    You can do a "hard reset policy" on that client using Client Center. 


    Torsten Meringer | http://www.mssccmfaq.de

    Thursday, April 30, 2015 6:15 AM
  • isn't there any information about where in WMI the advertisements are stored?

    running a policy reset seems a bit intrusive :)

    Thursday, April 30, 2015 6:20 AM
  • i now did the policy hard reset with the following powershell command

    Invoke-WmiMethod -ComputerName HOSTNAME -Namespace root\ccm -Class sms_client -Name ResetPolicy -ArgumentList 1

    Looks good so far. Information about the wmi internals would still be appreciated.

    • Proposed as answer by Yosef Blass Wednesday, January 31, 2018 8:53 PM
    Monday, May 04, 2015 11:01 AM
  • In early testing this would appear to be working for me as well. Great job!
    Wednesday, January 31, 2018 8:54 PM