1

I am running the code in my azure AD runbook with the MSOnline module installed:

Import-Module MSOnline
$credential = get-automationpscredential -name 'CoreyA'
Connect-MsolService -Credential $credential

But get the following error:

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

I have tried multiple variations of the code and just cannot seem to find a solution ANYWHERE. The code works on my local machine with powershell ISE when I connect to my run as account, but not in AAD.

  • Have you tried the solution on this page: https://social.msdn.microsoft.com/Forums/azure/en-US/7eff7b84-6833-4a0c-8bcd-715d6a4db4ac/unable-to-find-an-entry-point-named-getperadapterinfo-in-dll-iphlpapidll?forum=azureautomation – Owain Esau Oct 10 '18 at 00:04
  • Yeah, its unrelated to my code, but it still references the same .dll file, but their work around is using an api call which MSOL doesnt support when getting 365 users etc – Corey Williams Oct 10 '18 at 00:11
  • does running $error[0]|format-list -force provide you with any more information on the error? – Owain Esau Oct 10 '18 at 00:19
  • writeErrorStream : True Exception : System.EntryPointNotFoundException: Unable to find an entry point named 'GetPerAdapterInfo' in DLL 'iphlpapi.dll'. at Microsoft.IdentityModel.Clients.ActiveDirectory.Internal.Platform.WebUI.d__12.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() – Corey Williams Oct 10 '18 at 00:29

1 Answers1

0

I met this exception too and seems the root reason is the account I used for connecting to tenant enabled MFA. Using an account isn't enabled MFA will solve this issue. There is something wrong with reporting exception message in the latest MSOnline module, this issue directed me a wrong way and wasted me a lot of time. When you change the MSOnline version to 1.0, you will see the right exception message. MSOnline 1.0: https://www.powershellgallery.com/packages/MSOnline/1.0

Btw, I found a good way to solve Azure and O365 issues : https://support.microsoft.com/en-us/help/3174960/dev-chat-for-office365-azure this team will answer some queries for common Azure users too .

Stanley Gong
  • 11,522
  • 1
  • 8
  • 16
  • Btw, you can run Connect-MsolService with access token : https://learn.microsoft.com/en-us/powershell/module/msonline/connect-msolservice?view=azureadps-1.0 – Stanley Gong Jan 29 '19 at 01:21
  • 1
    Stan, you have no idea how much that helped me, especially the dev chat link, I've used that probably about 10 times. You're a legend. – Corey Williams Apr 04 '19 at 04:00