First, Get-Services is not a valid cmdlet. Second, you don’t have a scriptblock, you have a here-string. A scriptblock would look like this
$string = {
$processes= get-process
$store = get-service
}
However you can turn the here-string into a scriptblock like this.
$script = [scriptblock]::Create($string)
Once it’s a scriptblock, either the example I gave or the created $script, you can run it like this.
. $string
You could also use & to run the scriptblock but if you do actually want the variables $processes and $store to exist in the calling session you use the period. It’s essentially dot sourcing it, pulling it into the current session while executing it.