1 | $Code = Get-Content -Path U:\GitHub\Hyper-V\MrHyperV\public\Get-MrVmHost.ps1 -Raw |
In my previous blog article a few weeks ago on "Learning about the PowerShell Abstract Syntax Tree (AST)", I mentioned there was an easier way to retrieve the AST so that you didn't have to cast everything to a script block. There are two .NET static methods, ParseFile and ParseInput, that are part of the Parser class in the System.Management.Automation.Language namespace which can be used to retrieve the AST.
First, I’ll store the content of one of my functions in a variable.
The Read more [...]