What version of PowerShell.Create() is created?

PowerShell ps = PowerShell.Create().AddCommand("$PSVersionTable.PSVersion");
ps.Invoke();


This throws an error, stating that $PSVersionTable is not a function. I have PowerShell 7 installed where the code is running, and I've verified the commands still work there. So what is the SDK creating behind the scenes that's not compatible?
Was this page helpful?