Office-docs-powershell: Import-Module microsoftteams: Exception from HRESULT: 0x80131515

Created on 28 Feb 2020  路  6Comments  路  Source: MicrosoftDocs/office-docs-powershell

Hi,

In our workstation environments we cannot run the install-modules, as administrator accounts must not be able to connect to internet. So I did a manual download for .nupkg. Then I follow the instructions on: Installing PowerShell modules from a NuGet package

When I'm trying to import the module I get the following:

PS C:\> Import-Module microsoftteams

Import-Module : Could not load file or assembly 'file:///C:\Program Files\WindowsPowerShell\Modules\microsoftteams\net472\Microsoft.Teams.PowerShell.Auth
.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
At line:1 char:1
+ Import-Module microsoftteams
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Import-Module], FileLoadException
    + FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.PowerShell.Commands.ImportModuleCommand

Many of related instructions for the error code ask to remove the block from the file. But in our workstation, we do not store the information:

C:\>reg query HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments
    SaveZoneInformation    REG_DWORD    0x2
    HideZoneInfoOnProperties    REG_DWORD    0x1

Even so, I ran the following to unblock all of the files:
PS C:\> Get-childItem -Path "C:\Program Files\WindowsPowerShell\Modules\microsoftteams\" -Recurse | Unblock-File -Verbose

Is there any other reasons why this might come?

I have tested to run this with admin account and regular account.

teams

Most helpful comment

@Petri-X Glad to hear!
@yogkumgit please close this thread again.

All 6 comments

@officedocsbot assign @yogkumgit

Hello @Petri-X
While I setup my environment to test this... quick question, did it run successfully after you unblocked all the files?
Thanks for the info

Hello @Petri-X
Finally tested this.
First, I reproduced the error you shared, then, I tried first unblocking the .nupkg file BEFORE renaming it to .zip to extract the contents, and then tried to use it, it imported the microsoftteams module without error.

image

@get-itips Thank you very much for the contribution and updating the documentation with PR. @Petri-X Hope this update is helpful for you. Thanks for taking out some time to open the issue. Appreciate and encourage you to do the same in future also.

@get-itips Hero !!
That really did the trick. And answer for your earlier question, when I did a unblock for all files, that did not work either then.
Big thanks !! _o/

@Petri-X Glad to hear!
@yogkumgit please close this thread again.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kefujino picture kefujino  路  5Comments

KevinNSTA picture KevinNSTA  路  4Comments

federico-r-figueredo picture federico-r-figueredo  路  5Comments

BlasMS picture BlasMS  路  4Comments

TobieFysh picture TobieFysh  路  3Comments