Trigger ConfigMgr client actions

A few weeks ago, I came across the following article on refreshing the System Center Configuration Management client

Whenever I see a script, I always wonder, could it be done with a oneliner ?

As long as the script doesn’t care about the order of the ConfigMgr actions to be performed, yes, it’s achievable this way:

(New-Object -COM 'CPApplet.CPAppletMgr').GetClientActions() | 
Where { 
    $_.Name -match "(\sPolicy$)|(Collection\sCycle$)|(Updates)"
} | ForEach-Object {
    try {
        Write-Verbose -Message "Successfully executed $($_.Name)" -Verbose
    } catch {
        Write-Warning -Message "Failed to execute $($_.Name)"

I’ve even added some filtering on action names and error handling.

There’s always more than one way to skin a cat with PowerShell 😉


Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.