To overcome some difficulties in passing args and combining script blocks to be sent to multiple hosts, I am using [ScriptBlock]::Create() on a few existing ScriptBlocks and one text here string to populate variables in the ScriptBlock instead of passing args.
My issue is expanding certain variable types in the here string: This doesn't work, only $var1 expands out to create a valid string representation of a ScriptBlock for later conversion: $ScriptBlockArgs = @" `$foo = `"$PSCustomObject."KeyName"`" `$bar = `"$var1`" "@ This does work, but is likely unnecessary: $var0 = $Node."Instance-Name" $ScriptBlockArgs = @" `$foo = `"$var0`" `$bar = `"$var1`" "@ I realize the double quotes on KeyName are an issue, but I have tried everything I can think of to escape or pre expand it without success. It also bails when trying to assign a hash table into a new variable. Anyone have any ideas? Thanks. jlc ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ --- To manage subscriptions click here: http://lyris.sunbelt-software.com/read/my_forums/ or send an email to [email protected] with the body: unsubscribe ntsysadmin
