andrew-s-taylor / WindowsAutopilotInfo

GNU General Public License v3.0
61 stars 12 forks source link

Module suddenly stop working #20

Closed Nikolara97 closed 3 weeks ago

Nikolara97 commented 4 months ago

Hi Andrew,

Module was working without issues, but suddenly from yesterday each time I run it I am getting following issue. Any idea?

Loading all objects. This can take a while on large tenants Invoke-MgGraphRequest : The pipeline has been stopped. At C:\Program Files\WindowsPowerShell\Scripts\get-windowsautopilotinfocommunity.ps1:1959 char:26

Something went wrong. Error: Method not found: 'Void Microsoft.Graph.Authentication.AzureIdentityAccessTokenProvider..ctor(Azure.Core.TokenCredential, System.String[], Microsoft.Kiota.Authentication.Azure.ObservabilityOptions, System.String[])'. Stop-Transcript : An error occurred stopping transcription: The host is not currently transcribing. At D:\AutoPilot3.ps1:128 char:5

andrew-s-taylor commented 4 months ago

Hi, Can you confirm which version of the PowerShell SDK you have installed? The module microsoft.graph.authentication is the best one to check

Nikolara97 commented 4 months ago

Hey @andrew-s-taylor sorry for late response I was on vacation... After rolling back to older version of Graph.Authentification module everything work's again...

secotton commented 3 months ago

I'm having the same issue - been trying to get it working, but no avail. Going to a different version of Graph.Authentication isn't quite helping, nor is using the updated one from Microsoft they released today (2.19.0). What I've observed, is if I open a new PowerShell window, and re-run the get-windowsautopilotinfocommunity.ps1 script, it appears to function fine. However - the kicker is I can't for the life of me get it to run within the context of a script. It was all working great before Microsoft updated their Graph.Authentication module.

There's another post similar to this: https://github.com/microsoftgraph/msgraph-sdk-powershell/issues/2715

andrew-s-taylor commented 3 months ago

Hi, is it any particular command in the module, or all of them?

secotton commented 3 months ago

So I'm running this during the OOBE portion of a Windows setup (Shift + F10). I've got a PowerShell script that's hosted online that:

This is where the same error comes up.

Interestingly, if I run through this all manually, I get the same error. However, if I run Powershell from within a PowerShell window and re-run the same command ( get-windowsautopilotinfocommunity.ps1 -Online -AppId $AutopilotParams.AppId -AppSecret $AutopilotParams.secret -Tenantid $AutopilotParams.tenant -grouptag $GRPTAG ), it works as intended.

I tried also just specifying the -online parameter and used my own credentials, and same result.

Still working through the issues we saw came up last week around the time Microsoft updated the Graph module from 2.17 to 2.18. I was hoping 2.19 would have fixed it, but it seems it didn't as of yet.

andrew-s-taylor commented 3 months ago

Ah, it's probably the AZ and Graph modules causing issues again, it happened with one of the V1 versions as well which broke pagination.

As a workaround, try adding "-newdevice" to the command, that skips retreiving the device list so won't worry about pagination issues

secotton commented 3 months ago

Invoke-MgGraphRequest : The pipeline has been stopped. At C:\Program Files\WindowsPowerShell\Scripts\get-windowsautopilotinfocommunity.ps1:639 char:17

Add-AutopilotImportedDevice : System.MissingMethodException: Method not found: 'Void Microsoft.Graph.Authentication.AzureIdentityAccessTokenProvider..ctor(Azure.Core.TokenCredential, System.String[], Microsoft.Kiota.Authentication.Azure.ObservabilityOptions, System.String[])'. at Microsoft.Graph.PowerShell.Authentication.Core.Utilities.AuthenticationHelpers.d_ _10.MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine) at Microsoft.Graph.PowerShell.Authentication.Core.Utilities.AuthenticationHelpers.GetAuthenticationProviderAsync(IAu thContext authContext) at Microsoft.Graph.PowerShell.Authentication.Helpers.HttpHelpers.GetGraphHttpClient() at Microsoft.Graph.PowerShell.Authentication.Cmdlets.InvokeMgGraphRequest.d__109.MoveNext() At C:\Program Files\WindowsPowerShell\Scripts\get-windowsautopilotinfocommunity.ps1:2119 char:34

secotton commented 3 months ago

Before issuing the connect-azaccount, I had to issue: Update-AzConfig -EnableLoginByWam $false

Seems to be working again now as intended.

andrew-s-taylor commented 3 months ago

Thank you for letting me know. I'll add it as a comment in the next release :)

jmullenhub commented 3 months ago

Hey Andrew, I am having a similar issue, when trying to delete the device from Intune, I am getting an error. I have tried sdk 2.17.0, 2.18.0, and 2.19.0 and am getting the same error on each. I've been using this script for a long time and have never encountered this issue before. Here is the error I am getting.

Delete Intune Device Do you want to DELETE ~ from the Intune? [Y] Yes [N] No [?] Help (default is "N"): y Invoke-MgGraphRequest : DELETE https://graph.microsoft.com/beta/deviceManagement/managedDevices/ HTTP/1.1 400 Bad Request Transfer-Encoding: chunked Vary: Accept-Encoding Strict-Transport-Security: max-age=31536000 request-id: ede0f980-1af7-411c-8905-7e0acffec8d4 client-request-id: eb1c7800-a9e5-4a34-b048-49e60ea06443 x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"Central US","Slice":"E","Ring":"4","ScaleUnit":"003","RoleInstance":"DS1PEPF0001A35C"}} Date: Wed, 05 Jun 2024 16:52:57 GMT Content-Encoding: gzip Content-Type: application/json {"error":{"code":"No method match route template","message":"No OData route exists that match template ~/singleton/navigation with http verb DELETE for request /DeviceFE/StatelessDeviceFEService/deviceManagement/managedDev ices.","innerError":{"date":"2024-06-05T16:52:57","request-id":"ede0f980-1af7-411c-8905-7e0acffec8d4","client-request-i d":"eb1c7800-a9e5-4a34-b048-49e60ea06443"}}} At C:\Program Files\WindowsPowerShell\Scripts\AutopilotNuke.ps1:394 char:29

andrew-s-taylor commented 3 months ago

Hi, Is that the module, or the nuke script? Looking at the error, it hasn't been passed the device ID

jmullenhub commented 3 months ago

This is from running the nuke script, all other pieces of the script are working except the delete intune device portion. I removed the name of the device for anonymity purposes.

andrew-s-taylor commented 3 months ago

Does it list Intune devices before that? It's not populating any device names in your yes/no message