pass parameter values to Invoke-CMScript

The Invoke-CMScript cmdlet invokes a PowerShell script in Microsoft System Center Configuration Manager. System Center Configuration Manager has an integrated ability to run Powershell scripts. The scripts simplify building custom tools to administer software and let you accomplish mundane tasks quickly, allowing you to get large jobs done more easily and more consistently. For more information, see Create and run PowerShell scripts from the Configuration Manager console.

unfortunately the Invoke-CMScript doesn’t allow to pass values to defined  script params. if you want to do this, you have to invoke the script through the Configuration Manager console.

now i wrote the PowerShell function Invoke-SCCMScript, which allow to pass values to the CMScripts. you can find the function Invoke-SCCMScript at

this is an example, how to use it:

# parameters to send to the script
$InputParameters = @{
    param1 = 'Test 1'
    param2 = 'Test 2'

$Params = @{
    SiteServer        = ''
    SiteCode          = 'P00'
    ScriptName        = 'Test Script'
    TargetResourceIDs = '11111111'
    InputParameters   = $InputParameters
Invoke-SCCMScript @Params