Powershell: Convert String to Scriptblock

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInPin on PinterestShare on TumblrShare on RedditEmail this to someone

If you use PowerShell remoting in some scripts you will se you cannot use a string to send it with the Invoke-Command cmdlet.

So you can simple convert a String to a Scriptblock

Now here an example

Basically you could create a function for that.

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInPin on PinterestShare on TumblrShare on RedditEmail this to someone