SCCM and Powershell – Invoke Baseline evaluation on client

Here’s a quick post about how to invoke/trigger evaluation for a baseline on a client remotely.

It follows the same principal as invoking any evaluation in SCCM through WMI classes. I talked about it a little bit in my previous post SCCM and Powershell! adding nodes to a collection and trigger evaluation and if you want to trigger just the evaluation for deployments or hardware inventory etc you can do that.

But for this post i would just like to show a powershell function that i  called Invoke-BLEvaluation which invokes Baseline evaluation, either all of them or specific ones as long as you know their name.

If you want to do this against a collection in ConfigMgr you can find out how here

 


function Invoke-BLEvaluation
{
 param (
 [String][Parameter(Mandatory=$true, Position=1)] $ComputerName,
 [String][Parameter(Mandatory=$False, Position=2)] $BLName
 )
 If ($BLName -eq $Null)
{
 $Baselines = Get-WmiObject -ComputerName $ComputerName -Namespace root\ccm\dcm -Class SMS_DesiredConfiguration
}
 Else
{
 $Baselines = Get-WmiObject -ComputerName $ComputerName -Namespace root\ccm\dcm -Class SMS_DesiredConfiguration | Where-Object {$_.DisplayName -like $BLName}
}

$Baselines | % {

 ([wmiclass]"\\$ComputerName\root\ccm\dcm:SMS_DesiredConfiguration").TriggerEvaluation($_.Name, $_.Version) 

}

}

 

Call Example for a specific computer called SD010 and baseline called “Important Baseline for Servicedesk”

 


Invoke-BLEvaluation -ComputerName SD010 -BLName "Important Baseline for Servicedesk"

 

And when you run it it will appear like this

 

TriggerBL

 

Or if you just want to call all of the baselines deployed to the computer you can ignore the -BLName parameter like this

 


Invoke-BLEvaluation -ComputerName SD010

 

It will look something like this when its ran successfully from the ISE and since i have 3 baselines for this machine deployed it will invoke them one by one

 

triggerbl2

 

Until next time,

Cheers Timmy