microsoftgraph / powershell-intune-samples

This repository of PowerShell sample scripts show how to access Intune service resources. They demonstrate this by making HTTPS RESTful API requests to the Microsoft Graph API from PowerShell.
MIT License
1.35k stars 656 forks source link

MethodInvocationException Error #249

Open 4sa617 opened 1 year ago

4sa617 commented 1 year ago

I don't have a tremendous amount of experience with this sort of stuff, but after digging around for a few hours I was not able to find anyone with a similar error.

It appears when I attempt to run any script from (Powershell on linux), I am prompted with the request and then after inputing the UPN I get the following. I don't recieve a popup. I have run both the AzureAD and AzureADPreview module installs without error. I am already logged into the tenant from a chrome browser.

IntuneScriptError

I saw that a file was missing from what I am getting from the error, but that file doesn't appear to be in any repository so I can only assume that it is created on login? I also attempted this from a windows 10 Enterprise machine with the same error. From the windows machine I am not logged in with a local account, rather an O365 account (if that makes a difference).

Is there a step that I am missing? Any help would be greatly appriciated!

afran1488 commented 1 year ago

You have to install an older version that includes the file that is missing. Run: Install-Module -Name AzureAD -RequiredVersion 2.0.2.140 -Force -AllowClobber Even then, I think the JSON files have been removed from the location specified in the scripts.

4sa617 commented 1 year ago

@afran1488 Thank you! I will have to play with it. I ended up using a different solution in the end, but maybe this will give someone a point in the right direction.

josh-tasker commented 1 year ago

You have to install an older version that includes the file that is missing. Run: Install-Module -Name AzureAD -RequiredVersion 2.0.2.140 -Force -AllowClobber Even then, I think the JSON files have been removed from the location specified in the scripts.

I was seeing the same issue and this worked for me, but I will just flag up for anyone else reading that I did have to manually uninstall the default version (2.0.2.180) for version .140 to actually be invoked by the scripts. Thanks for your help.