Orchestrator: Solved ‘Cannot invoke this function because current host does not implement it’

This is a very frustrating error in SCORCH, Opalis, Orchestrator, whatever you want to call it. Bring on SMA because I’ve had enough!

Symptom 

When running a PowerShell Script or an Exchange Administrative PowerShell Command in PowerShell, the activity will fail with:

‘Cannot invoke this function because the current host does not implement it.’

Cause

The reason for this is that the command you’re trying to run is trying to send confirmation back to the shell (end-user) to provide Confirmation before enacting a change.  The Orchestrator host doesn’t have any mechanism to prompt for change, and thus the message we see.

As it turns out, the error message really was trying to help us, but just incredibly poorly written.

Resolution

There is a quick fix available for this, add either -Confirm:$false or -Force to your cmdlet, based on the command you’re using.

Suggestion: replace this message with ‘This cmd requires user feedbadk, and cannot be automated in it’s current form. Try reading the Get-Help page for the cmdlet used, and consider adding -Force or -Confirm:$false if your cmdlet requires it’.

Advertisements

One thought on “Orchestrator: Solved ‘Cannot invoke this function because current host does not implement it’

  1. Olivier Detilleux December 26, 2016 / 2:32 pm

    Hello,

    Consider also to remove any “write-host”

    😉

Have a code issue? Share your code by going to Gist.github.com and pasting your code there, then post the link here!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s