簡體   English   中英

為什么 PowerShell 不能加載文件或程序集來運行 Azure PowerShell 模塊?

[英]Why can't PowerShell load file or assembly to run Azure PowerShell Module?

我無法讓 PowerShell 運行connect-azaccount 當我調用它時(使用connect-azaccount -subscriptionid #######... )我得到:

connect-azaccount: The 'connect-azaccount' command was found in the module 'Az.Accounts', but the module could not be loaded. For more information, run 'Import-Module Az.Accounts'. At line:1 char:1 + connect-azaccount -subscriptionid #########... + ~~~~~~~~~~~~~~~~~ + CategoryInfo: ObjectNotFound: (connect-azaccount:String) [], CommandNotFoundException + FullyQualifiedErrorId: CouldNotAutoloadMatchingModule

根據此故障排除模塊,問題可能是過時的 .NET。 但是我更新到最新版本並沒有解決問題。 結果相同。

當我運行Import-Module Az.Accounts ,我得到:

Import-Module: Could not load file or assembly 'file://\\internal_corp_domain.com\Profiles\my_username\My Documents\WindowsPowerShell\Modules\Az.Accounts\1.8.0\Microsoft.Azure.PowerShell.Authentication.Abstractions.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) At line:1 char:1 + Import-Module Az.Accounts + ~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo: InvalidOperation: (:) [Import-Module], FileLoadException + FullyQualifiedErrorId: FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand

最后一個錯誤中的文件路徑令人費解。 它似乎可能是網絡共享。 網上有很多關於這個的討論,但除了我可能有一個與 NTFS 相關的被阻止文件之外,似乎沒有任何相關信息。 搜索 NTFS 告訴我它是什么,但我不知道如何找到一個塊,特別是當路徑是我無法訪問的網絡共享時。
任何指針?

從 PowerShell 5.1 升級到 PowerShell 7 解決了該問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM