Forum Discussion

Alex_Rechs's avatar
Alex_Rechs
Brass Contributor
Apr 14, 2023
Solved

Cannot connect to Exchange Online module via Runbook

That's very strange error that I came across a few times on my own workstation, but now I cannot get rid of it on Hybrid Worker machine.
My runbook connects to Exchange Online to perform get-mailbox cmdlet, however at the connect-exchangeonline phase I'm getting the following error: "exception"
: "Could not find file 'C:\\Windows\\TEMP\\a70a8826-0c1f-4902-b1bc-767587023327\\tmpEXO_rj4fdl4e.yzc.psd1'. (Could not find file 'C:\\Windows\\TEMP\\a70a8826-0c3f-4902-b2bc-767587023327\\tmpEXO_rj4fdl4e.yzc.psd1'.)"
I tried to uninstall, clean-up, restart, install previous version, nothing helps. Any ideas what could be the reason?
  • What helped to resolve the issue is to install Exchange Online management module V2 (Install-Module -Name ExchangeOnlineManagement -RequiredVersion 2.0.5).
    I have two version why it works the way it works:
    1. This issue is related with PowerShell version (I'm using 5.1 and it may be not fully supported by EOMv3) and it requires at least v7.
    2. This is an actual bug, but I have no time to put effort for investigation.
    I'm leaving error transcripts below for the future reference whoever gets this:
    For non-interactive:
    "exception": "Could not find file 'C:\\Windows\\TEMP\\5158977d-0c0a-4d8e-9a2c-36a2d88bb65e\\tmpEXO_zvn3zqdw.mjv.psd1'. (Could not find file 'C:\\Windows\\TEMP\\5158977d-0c0a-4d8e-9a2c-36a2d88bb65e\\tmpEXO_zvn3zqdw.mjv.psd1'.)"
    For interactive:
    Could not find file
    'C:\Users\TEST\AppData\Local\Temp\2\95fd959b-fa0f-47c5-be2a-f1ea93533467\tmpEXO_aomlgbj5.w1b.psd1'.
    At C:\Program
    Files\WindowsPowerShell\Modules\ExchangeOnlineManagement\3.1.0\netFramework\ExchangeOnlineManagement.psm1:733 char:21
    + throw $_.Exception;
    + ~~~~~~~~~~~~~~~~~~
    + CategoryInfo : OperationStopped: (:) [], FileNotFoundException
    + FullyQualifiedErrorId : Could not find file 'C:\Users\TEST\AppData\Local\Temp\2\95fd959b-fa0f-47c5-be2a-f1ea935
    33467\tmpEXO_aomlgbj5.w1b.psd1'.
  • Alex_Rechs's avatar
    Alex_Rechs
    Brass Contributor
    What helped to resolve the issue is to install Exchange Online management module V2 (Install-Module -Name ExchangeOnlineManagement -RequiredVersion 2.0.5).
    I have two version why it works the way it works:
    1. This issue is related with PowerShell version (I'm using 5.1 and it may be not fully supported by EOMv3) and it requires at least v7.
    2. This is an actual bug, but I have no time to put effort for investigation.
    I'm leaving error transcripts below for the future reference whoever gets this:
    For non-interactive:
    "exception": "Could not find file 'C:\\Windows\\TEMP\\5158977d-0c0a-4d8e-9a2c-36a2d88bb65e\\tmpEXO_zvn3zqdw.mjv.psd1'. (Could not find file 'C:\\Windows\\TEMP\\5158977d-0c0a-4d8e-9a2c-36a2d88bb65e\\tmpEXO_zvn3zqdw.mjv.psd1'.)"
    For interactive:
    Could not find file
    'C:\Users\TEST\AppData\Local\Temp\2\95fd959b-fa0f-47c5-be2a-f1ea93533467\tmpEXO_aomlgbj5.w1b.psd1'.
    At C:\Program
    Files\WindowsPowerShell\Modules\ExchangeOnlineManagement\3.1.0\netFramework\ExchangeOnlineManagement.psm1:733 char:21
    + throw $_.Exception;
    + ~~~~~~~~~~~~~~~~~~
    + CategoryInfo : OperationStopped: (:) [], FileNotFoundException
    + FullyQualifiedErrorId : Could not find file 'C:\Users\TEST\AppData\Local\Temp\2\95fd959b-fa0f-47c5-be2a-f1ea935
    33467\tmpEXO_aomlgbj5.w1b.psd1'.
  • Andres-Bohren's avatar
    Andres-Bohren
    Steel Contributor

    Alex_Rechs 

     

    I've seen that sometimes on my Client too.

    So far the only thing that helps is to close the PowerShell Session and start it again.

     

    By the way? The newest ExchangeOnline PowerShell Module installed?

     

    Regards

    Andres

     

    • Alex_Rechs's avatar
      Alex_Rechs
      Brass Contributor
      Yes, I used to sort it out by Module reinstallation or restart and it helped for interactive sessions. For non-interactive from Azure runbook nothing helps it seems. I tried different versions of Module, preview including.

Resources