Close Menu
    Facebook X (Twitter) Instagram
    Sunday, May 18
    X (Twitter) LinkedIn
    All about Endpoint Management
    • Home
    All about Endpoint Management
    Home»ConfigMgr (SCCM)»Script to Trigger machine policy agent on multiple machines

    Script to Trigger machine policy agent on multiple machines

    Eswar KonetiBy Eswar KonetiMarch 21, 7:47 pm2 Mins Read ConfigMgr (SCCM) 2,228 Views
    Share
    Facebook Twitter LinkedIn Reddit

    Long back,have posted script on how to trigger Machine policy or hardware inventory action on sccm client http://eskonr.com/2011/01/script-to-trigger-sccm-machine-policy-or-hardware-inventory-action-agent-on-sccm-clients/

    Here is an updated script which can be run on multiple machines with some changes to the script .

    You will need to have list of computers into notepad file into the same path where you save the script.

    on error resume next
    Dim oFSO, sFile, oFile, sText,Stuff, myFSO, WriteStuff
    Set oFSO = CreateObject("Scripting.FileSystemObject")
    Set myFSO = CreateObject("Scripting.FileSystemObject")
    Set WriteStuff = myFSO.OpenTextFile("Output.txt", 8, True)
    sFile = "input.txt"
    If oFSO.FileExists(sFile) Then
    Set oFile = oFSO.OpenTextFile(sFile, 1)
    Do While Not oFile.AtEndOfStream
    sText = oFile.ReadLine
    If Trim(sText) <> "" Then

    Set sho = CreateObject("WScript.Shell")
    strSystemRoot = sho.expandenvironmentstrings("%SystemRoot%")
    strCurrentDir = Left(Wscript.ScriptFullName, (InstrRev(Wscript.ScriptFullName, "\") -1))
    Dim oLocator
    Set oLocator = CreateObject("WbemScripting.SWbemLocator")
    Dim oServices
    Set oServices = oLocator.ConnectServer( stext, "root\ccm\invagt")
    sInventoryActionID = "{00000000-0000-0000-0000-000000000001}"
    oServices.Delete "InventoryActionStatus.InventoryActionID=""" & sInventoryActionID & """"
    wscript.sleep 3000
    Set cpApplet = CreateObject("CPAPPLET.CPAppletMgr")
    Set actions = cpApplet.GetClientActions
    For Each action In actions
    If Instr(action.Name,"Hardware Inventory") > 0 Then
    action.PerformAction
    End If
    Next
    stuff= sText & "item processed"
    WriteStuff.WriteLine(Stuff)
    End If
    Loop
    WriteStuff.Close
    SET WriteStuff = NOTHING
    SET myFSO = NOTHING
    oFile.Close
    Else
    WScript.Echo "File Not Found"
    End If

     

    since the above script created is to trigger hardware inventory action,You will have all the Actions ID given below for each.

      • Hardware Inventory – 00000000-0000-0000-0000-000000000001
      • Software Inventory – 00000000-0000-0000-0000-000000000002
      • Data Discovery – 00000000-0000-0000-0000-000000000003
      • Machine Policy Assignment Request – 00000000-0000-0000-0000-000000000021
      • Machine Policy Evaluation – 00000000-0000-0000-0000-000000000022
      • Refresh Default Management Point – 00000000-0000-0000-0000-000000000023
      • Refresh Location (AD site or Subnet) – 00000000-0000-0000-0000-000000000024
      • Software Metering Usage Reporting – 00000000-0000-0000-0000-000000000031
      • Source list Update Cycle – 00000000-0000-0000-0000-000000000032
      • Refresh proxy management point – 00000000-0000-0000-0000-000000000037
      • Cleanup policy – 00000000-0000-0000-0000-000000000040
      • Validate assignments – 00000000-0000-0000-0000-000000000042
      • Certificate Maintenance – 00000000-0000-0000-0000-000000000051
      • Branch DP Scheduled Maintenance – 00000000-0000-0000-0000-000000000061
      • Branch DP Provisioning Status Reporting – 00000000-0000-0000-0000-000000000062
      • Software Update Deployment – 00000000-0000-0000-0000-000000000108
      • State Message Upload – 00000000-0000-0000-0000-000000000111
      • State Message Cache Cleanup – 00000000-0000-0000-0000-000000000112
      • Software Update Scan – 00000000-0000-0000-0000-000000000113
      • Software Update Deployment Re-eval – 00000000-0000-0000-0000-000000000114
      • OOBS Discovery – 00000000-0000-0000-0000-000000000120

     

    configmgr hardware inventory agent actions intiate machine policy inventory agents Reset policies SCCM SCCM 2007 SCCM Trigger Machine policy on bulk computers script to trigger machine policy
    Share. Twitter LinkedIn Email Facebook Reddit

    Related Posts

    Optimize Your Intune Workflow with a Powerful Browser Extension

    March 22, 10:39 am

    Migrate Microsoft 365 Updates from SCCM/MECM to Intune for Co-Managed Devices

    February 11, 9:50 pm

    Investigating Co-Management Issues with Windows Endpoints in SCCM/Intune

    October 26, 10:45 pm

    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.