Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Cannot Invoke this function because the current host does not implement it"

Tags:

c#

powershell

Using the program here: http://www.codeproject.com/Articles/18409/Asynchronously-Execute-PowerShell-Scripts-from-C

I run into the error: Error in Script: System.Management.Automation.CmdletInvocationException: Cannot invoke this function because the current host does not implement it. ---> System.Management.Automation.Host.HostException: Cannot Invoke this function because the current host does not implement it.

When using a script I have in a local bin of one of our server, example by just typing in:

get-serverlist "property group" ServerRange | CollectPerfData.ps1*

like image 475
Troy Davis Avatar asked Jun 08 '26 03:06

Troy Davis


1 Answers

If you execute script that requires interaction with the host process e.g. Write-Host, Read-Host then you have to implement the host interfaces. Take a look at this script for an example of how to do that.

like image 159
Keith Hill Avatar answered Jun 10 '26 17:06

Keith Hill