I if a strings, which contains a powershell script block:
$scriptBlock = 'Param (
[string]$param1,
[string]$param2,
[switch]$param3
)
Write-Output ('param1: {0}' -f $param1)
Write-Output ('param2: {0}' -f $param2)
Write-Output ('param3: {0}' -f $param3)'
Inside a second string I have the arguments for the script block.
$arguments = '-param1 "param1Value" -param2 "param2Value" -param3'
My question is how can I invoke the script block with the aruments string?