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

Welcome Forums General PowerShell Q&A Exception calling "Invoke" with "0" argument(s): "Cannot find path '' because it

This topic contains 3 replies, has 3 voices, and was last updated by

 
Participant
1 month ago.

  • Author
    Posts
  • #177601

    Participant
    Topics: 1
    Replies: 1
    Points: 14
    Rank: Member

    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.

  • #177637

    Moderator
    Topics: 0
    Replies: 36
    Points: 339
    Team MemberHelping Hand
    Rank: Contributor

    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.

  • #177769

    Participant
    Topics: 0
    Replies: 18
    Points: 77
    Helping Hand
    Rank: Member

    Can you try importing the module from session instead of import-session command?

    $ExchangeSession = New-PSSession blah blah blah -credential $cred
    Import-Module modulename -PSSession $ExchangeSession
    

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

  • #177852

    Participant
    Topics: 1
    Replies: 1
    Points: 14
    Rank: Member

    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:

    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.

    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.

You must be logged in to reply to this topic.