我正在安装了MSOnline模块的Azure AD运行手册中运行代码:
Import-Module MSOnline
$credential = get-automationpscredential -name 'CoreyA'
Connect-MsolService -Credential $credential
但得到以下错误:
Connect-MsolService : Unable to find an entry point named 'GetPerAdapterInfo' in DLL 'iphlpapi.dll'.
At line:3 char:1
+ Connect-MsolService -Credential $credential
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [Connect-MsolService], EntryPointNotFoundException
+ FullyQualifiedErrorId :
System.EntryPointNotFoundException,Microsoft.Online.Administration.Automation.ConnectMsolService
我已经尝试了代码的多种变体,但似乎无法在任何地方找到解决方案。当我连接到我的运行方式帐户时,该代码适用于具有 Powershell ISE 的本地计算机,但在 AAD 中不起作用。
我也遇到了这个异常,似乎根本原因是我用于连接到租户启用的MFA的帐户。未启用帐户 MFA 将解决此问题。 在最新的MSOnline模块中报告异常消息有问题,这个问题引导我的方式错误,浪费了我很多时间。 将 MSOnline 版本更改为 1.0 时,您将看到正确的异常消息。 MSOnline 1.0: https://www.powershellgallery.com/packages/MSOnline/1.0
顺便说一句,我找到了解决 Azure 和 O365 问题的好方法:https://support.microsoft.com/en-us/help/3174960/dev-chat-for-office365-azure 这个团队也会回答一些针对普通 Azure 用户的查询。