Some background on the use of minishells, such as SQLPS
Jeffrey Snover posted a very clear article about minishells and SQL Server's use of it:
https://blogs.msdn.com/powershell/archive/2008/06/23/sql-minishells.aspx
Jeffrey is Powershell's Architect, well respected in the Powershell community, and it's good to read about his perspective on this.