Refresh Server Compliance State

Topics: missing Features
Oct 5, 2016 at 2:35 PM
Hi Roger,

I want to use the following command from your tool:

$SCCMUpdatesStore = New-Object -ComObject Microsoft.CCM.UpdatesStore
$SCCMUpdatesStore.RefreshServerComplianceState()

But I'm not sure if it's posible to do so. The command should be run with administrative rights.
Hope you can help!

Regards, Menno
Coordinator
Oct 5, 2016 at 5:49 PM
Hi Menno,

Running the command with administrative rights is not a problem, just make sure your account (or the account defined in the tool) has the rights to do what you want...

You are using a COMObject and that may have issues if you run it from a remote computer... But what exactly do you want to achieve ? Maybe there is another way to do it...

Regards

Roger
Oct 6, 2016 at 7:09 PM
Edited Oct 6, 2016 at 7:10 PM
Hoi Roger,

Thanks for the quick response!

At my work the people who are updating servers with windows updates at evening hours have to wait till the SCCM console is showing the correct compliance status (100%)
Sometimes they have to wait for more then an hour before the correct status is shown. I'm looking for a way to speed this up a little bit so they can go home earlier.

I found the code on the internet and now I'm trying to add it to your program.
After some google-ing I also found a one liner:

(New-Object -ComObject Microsoft.CCM.UpdatesStore).RefreshServerComplianceState()

Can I just use this or do I have to add some code to make it work? and what is the risk of using the COMObject?
Many thanks for the great application you have greated!

Regards,

Menno
Coordinator
Oct 10, 2016 at 7:17 AM
After Updates Scan- or Installation, you just have to trigger an "Send unsent state messages":
[void]([wmiclass]'ROOT\ccm:SMS_Client').TriggerSchedule('{00000000-0000-0000-0000-000000000111}');"Send unsent messages"
as per default, the Agent will queue the messages for 15min (can be configured in the Client Settings).

On the Server Side, you have to refresh the compliance state to get the correct compliance values.


Triggering a RefreshServerComplianceState will re-send all State messages for all assigned deployments which can generate a lot of load on the server if you trigger that on many machines at the same time...