A sample implementation of the PSHost abstract class for console applications. Not all members are implemented. Those that are not implemented throw a NotImplementedException exception.
Inheritance: System.Management.Automation.Host.PSHost, IHostSupportsInteractiveSession
        public PSWrapper(InputOutputBuffers buffers, Action exitCallback)
        {
            _buffers = buffers;
            _exitCallback = exitCallback;
            _psRemoteHost = new PSRemoteHost(buffers, this);

            var sessionState = InitialSessionState.CreateDefault();
            sessionState.Variables.Add(new SessionStateVariableEntry("cls_handler", new ClearHostHandler(buffers),"cls_handler"));

            _runspace = RunspaceFactory.CreateRunspace(_psRemoteHost, sessionState);
            _runspace.Open();

            using (var powerShell = PowerShell.Create())
            {
                powerShell.Runspace = _runspace;
                powerShell.AddScript("function Clear-Host() { $cls_handler.Clear() }");
                powerShell.Invoke();
            }
        }