Exception calling "Invoke" with "0" argument(s): "Cannot find path '' because it

Folks, please forgive me if I’m using this forum all wrong. I’m getting the error in the subject when attempting to run the Get-Help command for any remotely connected sessions. So, in case I’m describing that wrong let me expand. So if I set up some credentials in $cred and say do a:

$ExchangeSession = New-PSSession blah blah blah -credential $cred

Import-PSSession $ExchangeSession

(it prompts for credentials then uses them to connect to my O365 and downloads the cmdlets, I think)

I get the all the Exchange cmdlets for my Exchange Online (O365) environment right?

So, if I run “Get-Mailbox” I get a list of mailboxes, but if I type Get-Help Get-Mailbox I get the following error:

get-help : Exception calling "Invoke" with "0" argument(s): "Cannot find path '' because it does not exist." At line:1 char:1 + get-help get-mailbox + ~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Get-Help], MethodInvocationException + FullyQualifiedErrorId : CmdletInvocationException

Can enyone explain why?

Thanks in advance.

Hey collin97,

I’ve moved this to the General PowerShell Q&A board instead of the website feedback board, as it seems to fit a lot better.

I’ve not seen that issue before. If I had to guess, I’d say Get-Help was trying to search for on-disk help files and failing, though I’m not sure how to get past that.

Having said that, notes in the Get-Help definition seem to suggest that Exchange treats things in a special way (though you may not be using this version of Get-Help, etc, so I’m unsure how relevant this is).

The best thing I can suggest in the meantime is to refer to docs.microsoft.com.

Can you try importing the module from session instead of import-session command?
[PRE]
$ExchangeSession = New-PSSession blah blah blah -credential $cred
Import-Module modulename -PSSession $ExchangeSession
[/PRE]

Above method works fine for me with ActiveDirectory and VMWare modules including help system. Not sure about the exchange.

Thanks for moving this to the right place James. Also, thanks rejikodiyil for your suggestion, but if I run the Import-Module command:

Import-Module Exchange -PSSession $ExchangeSession

I get the following error:
<p class=“p1” style=“padding-left: 40px;”>Import-Module : Failure from remote command: Import-Module -Name ‘exchange’: The term ‘Import-Module’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.</p>
Which is very strange since we know the command “Import-Module” is definitely a valid command. The fact that the start of the message expands the ‘-Name’ parameter when the command was entered without the ‘-Name’ suggests PowerShell recognized the Cmdlet.

I think where my issue differs from yours rejikodiyil, is the fact that the PSSession to Exchange is to the O365 Exchange in the Microsoft cloud so there is no local installation of the modules. I’ll post this on the Microsoft forums and see if one of the MVPs can actually explain why the Get-Help response doesn’t seem to be able to traverse the remote connection.