Closed Nikolara97 closed 3 weeks 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
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...
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
Hi, is it any particular command in the module, or all of them?
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.
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
Invoke-MgGraphRequest : The pipeline has been stopped. At C:\Program Files\WindowsPowerShell\Scripts\get-windowsautopilotinfocommunity.ps1:639 char:17
+ CategoryInfo : NotSpecified: (:) [Invoke-MgGraphRequest], PipelineStoppedException
+ FullyQualifiedErrorId : Microsoft.Graph.PowerShell.Authentication.Cmdlets.InvokeMgGraphRequest
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.
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Add-AutopilotImportedDevice
Before issuing the connect-azaccount, I had to issue: Update-AzConfig -EnableLoginByWam $false
Seems to be working again now as intended.
Thank you for letting me know. I'll add it as a comment in the next release :)
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
+ CategoryInfo : InvalidOperation: (Method: DELETE,...nt-Length: 0
}:HttpRequestMessage) [Invoke-MgGraphRequest], HttpResponseException
+ FullyQualifiedErrorId : InvokeGraphHttpResponseException,Microsoft.Graph.PowerShell.Authentication.Cmdlets.Invok
eMgGraphRequest
Hi, Is that the module, or the nuke script? Looking at the error, it hasn't been passed the device ID
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.
Does it list Intune devices before that? It's not populating any device names in your yes/no message
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