PowerShell – Refresh SCCM Updates Compliance

Here’s a quick post since I haven’t posted in a while.

Some of you SCCM users will run into circumstances where a system should be compliant with your current update deployment.  However, it doesn’t report properly in the report server within SCCM.

The “old” SMS way to do that was a common VBscript:  http://msdn.microsoft.com/en-us/library/cc146437.aspx

Ah, VBscript.  Well now, let’s do that in PowerShell!  This is so simple and only takes two lines.

You can easily do this using System Center Orchestrator as well.  Just combine the Execute PowerShell Script IP with the Configuration Manager IP for 2012 and you’re all set.  Just get collection members and then run this against each member of the collection.

Here’s the PowerShell way:

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

Voila!

(just remember to run as “Administrator”)

Advertisements

7 Responses to PowerShell – Refresh SCCM Updates Compliance

  1. Daniel says:

    Or even better, one line:
    (New-Object -ComObject Microsoft.CCM.UpdatesStore).RefreshServerComplianceState()

  2. Pingback: Scott’s IT Blog

  3. Shekhar Mantry says:

    Does this work under SYSTEM account ?

  4. Shekhar Mantry says:

    We run everything under SYSTEM account in our domain.

  5. Lenny says:

    Great post. Is there a way to do this remotely? So if i have a list of machines I can just hit them instead of creating a package?

    Thanks
    Lenny

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: