Simplified PowerShell 3.0 code to use AST

The original implementation using tokens / parsing was intended for PowerShell 2.0.
Since that didn't turn out to work anyway, the 3.0+ code can now just use the AST.