Skip to content

Connect-MgGraph fails with warnings when called in a PS1 script #3461

Closed

Description

@hjrb

Describe the bug

WARNING: Selected Microsoft Graph profile 'v1.0' does not exist for module 'Microsoft.Graph.Financials'. No cmdlets were loaded.
WARNING: Selected Microsoft Graph profile 'v1.0' does not exist for module 'Microsoft.Graph.WindowsUpdates'. No cmdlets were loaded.
$PipelineStoppedException/   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
   at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary`2 functionsToDefine, List`1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)
   at System.Management.Automation.ScriptBlock.<>c__DisplayClass57_0.<InvokeWithPipe>b__0()
   at System.Management.Automation.Runspaces.RunspaceBase.RunActionIfNoRunningPipelinesWithThreadCheck(Action action)
   at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List`1 variablesToDefine, Dictionary`2 functionsToDefine, Object[] args)
   at System.Management.Automation.ScriptBlock.DoInvokeReturnAsIs(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Object[] args)
   at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(ScriptBlock sb, Boolean useNewScope, PipelineResultTypes writeToPipeline, IList input, Object[] args)
   at Microsoft.Graph.PowerShell.Runtime.PowerShell.PsHelpers.RunScript[T](CommandInvocationIntrinsics cii, String script)
   at Microsoft.Graph.PowerShell.Runtime.PowerShell.PsHelpers.GetScriptCmdlets(PSCmdlet cmdlet, String scriptFolder)
   at Microsoft.Graph.PowerShell.Runtime.PowerShell.GetScriptCmdlet.ProcessRecord()

Expected behavior

It should open a browser windows.

How to reproduce

Put Connect-MgGraph into ps1 script
Call script

SDK Version

 EntraGroups  Get-Module Microsoft.Graph*  ModuleType Version    Name                                ExportedCommands ---------- -------    ----                                ---------------- Script     1.17.0     Microsoft.Graph.Authentication      {Add-MgEnvironment, Connect-MgGraph, Disconnect-MgGraph, Get-MgContext...} Script     1.17.0     Microsoft.Graph.Bookings            {Get-MgBookingBusiness, Get-MgBookingBusinessAppointment, Get-MgBookingBusinessCalendarView, Get-MgBook... Script     1.17.0     Microsoft.Graph.ChangeNotifications {Get-MgSubscription, Invoke-MgReauthorizeSubscription, New-MgSubscription, Remove-MgSubscription...} Script     1.17.0     Microsoft.Graph.CloudCommunications {Add-MgCommunicationCallLargeGalleryView, Clear-MgCommunicationPresence, Clear-MgCommunicationPresenceU... Script     1.17.0     Microsoft.Graph.CrossDeviceExper... {Get-MgUserActivity, Get-MgUserActivityHistoryItem, Get-MgUserActivityHistoryItemActivity, New-MgUserAc... Script     1.17.0     Microsoft.Graph.DeviceManagement    {Get-MgDeviceManagement, Get-MgDeviceManagementDetectedApp, Get-MgDeviceManagementDetectedAppManagedDev... Script     1.17.0     Microsoft.Graph.DeviceManagement... {Clear-MgDeviceManagementManagedDevice, Disable-MgDeviceManagementManagedDeviceLostMode, Disconnect-MgD... Script     1.17.0     Microsoft.Graph.Devices.CloudPrint  {Get-MgPrint, Get-MgPrintConnector, Get-MgPrintOperation, Get-MgPrintPrinter...} Script     1.17.0     Microsoft.Graph.Devices.ServiceA... {Get-MgServiceAnnouncementHealthOverview, Get-MgServiceAnnouncementHealthOverviewIssue, Get-MgServiceAn... Script     1.17.0     Microsoft.Graph.Education           {Get-MgEducationClass, Get-MgEducationClassAssignment, Get-MgEducationClassAssignmentCategory, Get-MgEd... Script     1.17.0     Microsoft.Graph.Files               {Add-MgDriveListContentTypeCopy, Add-MgDriveListContentTypeCopyFromContentTypeHub, Add-MgShareListConte... Script     1.17.0     Microsoft.Graph.Financials Script     1.17.0     Microsoft.Graph.Groups              {Add-MgGroupDriveListContentTypeCopy, Add-MgGroupDriveListContentTypeCopyFromContentTypeHub, Add-MgGrou... Script     1.17.0     Microsoft.Graph.Identity.Directo... {Confirm-MgContactMemberGroup, Confirm-MgContactMemberObject, Confirm-MgContractMemberGroup, Confirm-Mg... Script     1.17.0     Microsoft.Graph.Identity.SignIns    {Confirm-MgRiskyUserCompromised, Get-MgDataPolicyOperation, Get-MgIdentityApiConnector, Get-MgIdentityB... Script     1.17.0     Microsoft.Graph.Notes               {Get-MgGroupOnenoteNotebook, Get-MgGroupOnenoteNotebookSection, Get-MgGroupOnenoteNotebookSectionGroup,... Script     1.17.0     Microsoft.Graph.People              {Get-MgUserLastSharedMethodInsight, Get-MgUserPerson, Get-MgUserSharedInsight, Get-MgUserSharedResource... Script     1.17.0     Microsoft.Graph.Planner             {Get-MgGroupPlanner, Get-MgGroupPlannerPlan, Get-MgGroupPlannerPlanBucket, Get-MgGroupPlannerPlanDetail... Script     1.17.0     Microsoft.Graph.Reports             {Get-MgAuditLogDirectoryAudit, Get-MgAuditLogProvisioning, Get-MgAuditLogSignIn, Get-MgDeviceManagement... Script     1.17.0     Microsoft.Graph.SchemaExtensions    {Get-MgSchemaExtension, New-MgSchemaExtension, Remove-MgSchemaExtension, Update-MgSchemaExtension} Script     1.17.0     Microsoft.Graph.Security            {Add-MgSecurityCaseEdiscoveryCaseCustodianHold, Add-MgSecurityCaseEdiscoveryCaseNoncustodialDataSourceH... Script     1.17.0     Microsoft.Graph.Teams               {Add-MgChatMember, Add-MgTeamChannelMember, Add-MgTeamMember, Add-MgTeamPrimaryChannelMember...} Script     1.17.0     Microsoft.Graph.Users               {Get-MgUser, Get-MgUserCreatedObject, Get-MgUserDirectReport, Get-MgUserExtension...} Script     1.17.0     Microsoft.Graph.Users.Functions     {Get-MgAllUserChatMessage, Get-MgUserCalendarEventDelta, Get-MgUserChatMessageDelta, Get-MgUserChatMess...

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

Activity

  1. secretworkpersona commented on Dec 10, 2025

    @secretworkpersona

    You probably already know that version 1.17.0 is very old (11/2022). The modules reported missing no longer exist as separate modules in the current version. The fact that they were called but missing indicates a problem with your modules' installations. If it were me (and there isn't a dependency on version 1.17.0), I'd remove every trace of Graph modules from my device and reinstall the current version.

  2. gavinbarron commented on Dec 18, 2025

    @gavinbarron
    Member

    Please update to the latest version of the Microsoft.Graph PowerShell cmdlet for your scenario.

    We're not fixing issues with v1.x stuff.

    If you have problems with the latest version then please open a new issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions