Quantcast
Channel: All about Microsoft Endpoint Manager
Viewing all articles
Browse latest Browse all 444

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

$
0
0

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 thus only use script to achieve 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.

If you are looking for something similar for CM12 what we performed on SCCM 2007 clients remotely,you can use below Vb script.

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/

SCCM Configmgr 2012 script to Trigger Machine policy inventory and other actions on Clients is a post from: Eswar Koneti's Blog


Viewing all articles
Browse latest Browse all 444

Trending Articles