Friday, April 27, 2007

SMS Client Actions

This has been posted may places but I will post it here too since they are all relative.
You can do many actions from the client side manually but you can also pass down the command from the SMS server.

What are some of these good for? Maybe you want to push an application down through some collections but the collection require a HW inventory to check the add/remove programs first. If your HW inventory is set for every 3 days it could then take 3 days to get that software fully installed. Now you can push a VBS file to force the HW inventory at the end of the package adv. If you have your collection updating say every 8 hours or less then it will install quicker.



Force the client to change the SMS cache size in MB
---------------------cachesize.vbs-------
Dim oUIResourceDim oCache
Set oUIResource = CreateObject("UIResource.UIResourceMgr")Set objCacheInfo = oUIResource.GetCacheInfo
'change to 2000MB
objCacheInfo.TotalSize = 2000
Set oUIResource = NothingSet objCacheInfo = Nothing
-------------------------------------------------------------------

Force the cleaning of SMS Cache
-------------------clean cache.vbs---------------------------------------------
on error resume next
dim oUIResManager
dim oCachedim oCacheElement
dim oCacheElements
set oUIResManager = createobject("UIResource.UIResourceMgr")
if oUIResManager is nothing then
wscript.quit
end if
set oCache=oUIResManager.GetCacheInfo()
if oCache is nothing then
set oUIResManager=nothing
wscript.quit
end if
set oCacheElements=oCache.GetCacheElements
for each oCacheElement in oCacheElements
oCache.DeleteCacheElement(oCacheElement.CacheElementID)
next
set oCacheElements=nothing
set oUIResManager=nothing
set oCache=nothing
wscript.quit
--------------------------------------



Software / Hardware Inventory
----------------------SW-HW.vbs---------------
On Error Resume Next
Dim oCPAppletMgr
Set oCPAppletMgr = CreateObject("CPApplet.CPAppletMgr")
Dim oClientActions
Set oClientActions = oCPAppletMgr.GetClientActions()
Dim oClientAction
For Each oClientAction In oClientActions
If oClientAction.Name = "Software Inventory Collection Cycle" Then
oClientAction.PerformAction
End If
If oClientAction.Name = "Hardware Inventory Collection Cycle" Then
oClientAction.PerformAction
End If
Next
-----------------------------------

Policy Refres
----
On Error Resume Next
Dim oCPAppletMgr
Set oCPAppletMgr = CreateObject("CPApplet.CPAppletMgr")
Dim oClientActions
Set oClientActions = oCPAppletMgr.GetClientActions()
Dim oClientAction
For Each oClientAction In oClientActions
If oClientAction.Name = "Discovery Data Collection Cycle" Then
oClientAction.PerformAction
End If
If oClientAction.Name = "Request & Evaluate Machine Policy" Then oClientAction.PerformAction
End If
Next
------