IT 专业人士的资源 >
论坛主页
>
Configuration Manager SDK
>
How to monitor a SCCM (SMS 4) Machine Policy Retrieval & Evaluation Cycle
How to monitor a SCCM (SMS 4) Machine Policy Retrieval & Evaluation Cycle
Hi, i am after a vbscript method to monitor when a Machine Policy Retrieval & Evaluation Cycle is in progress, because it can take several minitues to complete I would like my script to wait until the process has completed before continuing.
This is the code used to start the process:On Error Resume Next
any help would be great.
Dim oCPAppletMgr 'Control Applet manager object.
Dim oClientAction 'Individual client action.
Dim oClientActions 'A collection of client actions.
'Get the Control Panel manager object.
Set oCPAppletMgr = CreateObject("CPApplet.CPAppletMgr")
If Err.Number <> 0 Then
Wscript.Echo "Couldn’t create control panel application manager"
WScript.Quit
End If
'Get a collection of actions.
Set oClientActions = oCPAppletMgr.GetClientActions
If Err.Number <> 0 Then
WScript.Echo "Couldn’t get the client actions"
Set oCPAppletMgr = Nothing
WScript.Quit
End If
'Display each client action name and perform it.
For Each oClientAction In oClientActions
If oClientAction.Name = "Request & Evaluate Machine Policy" Then
WScript.Echo "Performing action " + oClientAction.Name
oClientAction.PerformAction
End If
Next
Set oClientActions = Nothing
Set oCPAppletMgr = Nothing
Regards
Rodney
EDIT: I am using SCCM (SMS version 4)- 已编辑Rodent_111 2009年11月24日 1:47
全部回复
- Hi,
This is a SCCM forum, for SMS question please refer to relevant newsrgoup:
http://technet.microsoft.com/en-us/sms/bb839598.aspx
HTH.
Jie-Feng Ren - MSFT - has no one have an answer to this problem, it can be Visual Basic code or VBScript but I need a way to tell when the Machine Policy Retrieval & Evaluation Cycle starts, stops or is running.
Any help please...
Regards
Rodney - Other than watching the log files for the tell-tell signs I don't know how you can watch other than possible watching inside of the WMI Repository.
What are you trying to accomplish by monitoring the Policy Cycle?
http://www.sccm-tools.com http://sms-hints-tricks.blogspot.com - I am wanting to write an application that sits in the system tray so that a user may initiate a policy update and the application will let the user know when the policy update is completed. If you have ever used zenworks you will know exactly what I am talking about as zenworks have been doing this kind of thing for ages.
Even if you could tell me what to look for in the log files and what log files to look in would be great but I would really like a WMI or API method.
I have tried to look at the THREADS created under CcmExec.exe when an policy update is run and than monitor when these THREADS end but being event driven this is not working.
Thanks for any help
Rodney - I dont' know if this will be much help but you can look in WMI
root\CCM\Policy
http://msdn.microsoft.com/en-us/library/cc145735.aspx
since this is how you can change or force full policy to run and other actions. I would think you could also monitor somewhere in here. It could be as simple as a mutex changing from 0 to 1 /state to state.
I will see if I can find some info to help you out. It might be a useful tool I can post on my tools website.
http://www.sccm-tools.com http://sms-hints-tricks.blogspot.com- 已编辑Matthew Hudson [MVP]MVP2009年12月1日 13:55add link to wmi policy
- Well if you created an agent to watch WMI you could watch the root\ccm\events
When the policy is started on the client it is setup in here
CCM_PolicyAgent_AssignmentsRequested
This will give you the threadID and date time as well as if it is a user or machine all should be unique.
CCM_PolicyAgent_AssignmentsReceived might also help.
Once done you should be able to look at the CCM_PolicyAgent_PolicyApplied
From the quick look I don't see it storing information so you might have to use an agent to watch when data arrives or leaves these areas.
Maybe this will get you started.
http://www.sccm-tools.com http://sms-hints-tricks.blogspot.com