Archive for January 26th, 2012
VBScript to Run SCCM Software Updates Scan
Posted by N. Moseley in ConfigMgr 07 on January 26, 2012
A challenge with installing software updates during a task sequence is that it may occur where not all updates are applied on the first pass. The workaround is run software updates, run a VB Script or PowerShell script to force another scan, then run a software updates task again. Others have posted their scripts on this before, so it’s nothing new. However, I failed trying to quickly locate those scripts. So I’m just posting my own of what I use….
'==========================================================================
' AUTHOR: Nick Moseley , http://t3chn1ck.wordpress.com
' DATE : 7/30/2010
' COMMENT: Initiates an SCCM client scan
' Script from http://msdn.microsoft.com/en-us/library/cc144313.aspx
' Updated 7/15/11 to include a sleep before exiting script
'==========================================================================
' Set the required variables.
actionNameToRun = "Updates Source Scan Cycle"
' Create a CPAppletMgr instance.
Dim oCPAppletMgr
Set oCPAppletMgr = CreateObject("CPApplet.CPAppletMgr")
' Get the available ClientActions object.
Dim oClientActions
Set oClientActions = oCPAppletMgr.GetClientActions()
' Loop through the available client actions. Run the matching client action when it is found.
Dim oClientAction
For Each oClientAction In oClientActions
If oClientAction.Name = actionNameToRun Then
oClientAction.PerformAction
End If
Next
' Wait for 3 minutes for scan completion before exiting script
wscript.sleep(180000)


Recent Comments