Forum Discussion
hh775624
Dec 31, 2019Copper Contributor
nice to have code only once in code scope
Hi, does someone see a chance to simplify the following script? I would like to place the code only once, not twice ($code01 & function code01) in code scope, the output of course should be the sam...
JoP_SG
Jan 07, 2020Copper Contributor
Hello,
there are two possibilities.
- Just define $code01 and call it with Invoke-Command -ScriptBlock $code01
- Just define function code01 and get the definition with (Get-Item function:code01).Definition