Close Menu
    Facebook X (Twitter) Instagram
    Monday, May 19
    X (Twitter) LinkedIn
    All about Endpoint Management
    • Home
    All about Endpoint Management
    Home»CM2012»SCCM Configmgr 2012 script to Trigger Machine policy inventory and other actions on Clients

    SCCM Configmgr 2012 script to Trigger Machine policy inventory and other actions on Clients

    Eswar KonetiBy Eswar KonetiAugust 13, 1:55 pm2 Mins Read CM2012 5,663 Views
    Share
    Facebook Twitter LinkedIn Reddit

    In SCCM 2007 ,to initiate machine policy /hardware inventory and other actions on client,we use vb script/wmic/Powershell/Right click Tools and other tools like Client center,collection commander etc.Some organizations do not like to install any of these tools.In that cases,we have only option of using scripts. to achive it

    The most common Script that is used to trigger policy agent on SCCM 2007 clients remotely is blogged here

    In Configuration Manager 2012,we have something called fast channel (Client notification) to download Machine Policy.

    At times,you see some weired issues with sccm clients with respect to hardware inventory and they never get updated with right inventory because of its previous inventory (deltas) though you see inventory is successful from inventoryagent.log

    How do we perform full hardware inventory on configmgr client ? The Script attached here does removal of hinv action item from wmi and try to force hardware inventory cycle. For more information about hardware inventory troubleshooting,refer http://blogs.technet.com/b/sudheesn/archive/2010/05/31/troubleshooting-sccm-part-ii-hardware-inventory.aspx

    The below VB script is written to Trigger Hardware inventory agent on clients:

    'Declare Variables
    On Error Resume Next
    Set sho = CreateObject("WScript.Shell")
    strSystemRoot = sho.expandenvironmentstrings("%SystemRoot%")
    strCurrentDir = Left(Wscript.ScriptFullName, (InstrRev(Wscript.ScriptFullName, "\") -1))
    ' Get a connection to the "root\ccm\invagt" namespace (where the Inventory agent lives)
    Dim oLocator
    Set oLocator = CreateObject("WbemScripting.SWbemLocator")
    Dim oServices
    Set oServices = oLocator.ConnectServer( , "root\ccm\invagt")
    'Reset SMS Hardware Inventory Action to force a full HW Inventory Action
    sInventoryActionID = "{00000000-0000-0000-0000-000000000101}"
    ' Delete the specified InventoryActionStatus instance
    oServices.Delete "InventoryActionStatus.InventoryActionID=""" & sInventoryActionID & """"
    'Pause 3 seconds To allow the action to complete.
    wscript.sleep 3000
    'Run a SMS Hardware Inventory
    Set cpApplet = CreateObject("CPAPPLET.CPAppletMgr")
    Set actions = cpApplet.GetClientActions
    For Each action In actions
    If Instr(action.Name,"Hardware Inventory Collection") > 0 Then
    action.PerformAction
    End If
    Next

    Note:Replace the quotes used in the script as they converted to fancy quotes.

    If you want to run other actions,please replace the ActionID and Action name as given below:

      • Software Metering Usage Report :00000000-0000-0000-0000-000000000106
      • Request & Evaluate Machine Policy :8EF4D77C-8A23-45c8-BEC3-630827704F51
      • Updates Source Scan :00000000-0000-0000-0000-000000000113
      • Request & Evaluate User Policy:3A88A2F3-0C39-45fa-8959-81F21BF500CE
      • Hardware Inventory Collection:00000000-0000-0000-0000-000000000101
      • Software Inventory Collection:00000000-0000-0000-0000-000000000102
      • Application Global Evaluation:00000000-0000-0000-0000-000000000123
      • Software Updates Assignments Evaluation:00000000-0000-0000-0000-000000000108
      • Discovery Data Collection:00000000-0000-0000-0000-000000000103
      • MSI Product Source Update:00000000-0000-0000-0000-000000000107
      • Standard File Collection:00000000-0000-0000-0000-000000000104

     

    To Know How to run this script on remote clients using psexec ? Read blog post http://eskonr.com/2011/01/script-to-trigger-sccm-machine-policy-or-hardware-inventory-action-agent-on-sccm-clients/

    you can download the script from technet Gallary

    agent CM12 force hardware inventory full hardware inventory machine policy policy psexec SCCM 2012 trigger trigger on remote clients trigger policy agents
    Share. Twitter LinkedIn Email Facebook Reddit

    Related Posts

    How to detect the source of registry key modifications on windows devices – Intune

    November 21, 8:49 pm

    Identifying devices managed by Intune but not reporting to WUfB using KQL

    November 09, 10:28 am

    Monitoring Endpoint Security Applications with SCCM ConfigMgr SQL

    October 11, 8:48 pm

    4 Comments

    1. Chris on February 21, 2014 11:19 AM

      Hello, Does this work if placed towards the end of an OSD task sequence? we need to make sure machines perform full hardware inventory as soon as possible after machines are deployed.

      Reply
      • Eswar Koneti on February 23, 2014 8:31 AM

        Hi Chris,
        This script is to trigger the existing policies but while doing OSD,client will not have have all actions in WMI,it may take sometime to get the policies from Site server.so if you try to add this script in TS,it cannot trigger the actions which are not available in WMI ,except machines policy and user policy.
        But you can give a try how it works.

        Reply
    2. Lewis on September 2, 2013 8:08 AM

      Can you not do this sort of stuff with the SCCM Client Center?

      Reply
      • Eswar Koneti on September 16, 2013 7:53 AM

        Yes,You can do this with Client Center but i have seen in the past that,Client center and other third party tools are not allowed while working with some of the clients. so posted if someone would be interested.

        Reply

    Leave a ReplyCancel reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.

    Sign Up

    Get email notifications for new posts.

    Author

    I’m Eswar Koneti ,a tech enthusiast, security advocate, and your guide to Microsoft Intune and Modern Device Management. My goal? To turn complex tech into actionable insights for a streamlined management experience. Let’s navigate this journey together!

    Support

    Awards

    Archives

    © Copyright 2009-2024 Eswar Koneti, All rights reserved.

    Type above and press Enter to search. Press Esc to cancel.