# Pass your collection script and parameters, it will do the rest Invoke-PowerStash -Scriptblock ${function:Get-CimEvents} ` -Parameters @{CimSession=$Sessions;LogName='Security';EventId=4624}