ESwar KONeti

All about Configmgr and its Connected Objects….

  • About Author
      View eswar koneti's LinkedIn profile
  • Archives

  • Meta

  • Copyright!

    All the blog posts in this website are owned by Eswar Koneti and may not be reused in any mode without prior approval of Eswar Koneti. You may quote one paragraph from the blog posts if you link to the original blog post.
    Happy Reading!

  • Awards


  • Follow Updates

Script to Trigger machine policy agent on multiple machines

Posted by Eswar Koneti on 21st March 2012

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

 

Tags: , , , , , , , , ,
Posted in ConfigMgr (SCCM), Configmgr2012, SCCM 2007, SCCM 2012, Scripting, Software Distribution, WMI | No Comments »