microsoftgraph / msgraph-sdk-powershell

Powershell SDK for Microsoft Graph
https://www.powershellgallery.com/packages/Microsoft.Graph
Other
711 stars 172 forks source link

Reset-MgUserAuthenticationMethodPassword : Object reference not set to an instance of an object. #2220

Closed AhmadOsman closed 1 year ago

AhmadOsman commented 1 year ago

The issue is;

Reset-MgUserAuthenticationMethodPassword : Object reference not set to an instance of an object.

To Reproduce Steps to reproduce the behavior:

I think the issue started after I updated Microsoft.Graph module to the last version 2.2.0

Then I always get this error, when I run the command Reset-MgUserAuthenticationMethodPassword : Object reference not set to an instance of an object. as the fiollowing;

Get-InstalledModule Microsoft.Graph

Version Name Repository Description


2.2.0 Microsoft.Graph PSGallery Microsoft Graph PowerShell module

$user_email = 'testaccount@gmail.com' Get-MgUserAuthenticationPasswordMethod -UserId $user_email $password = 'P@ssw0rd'

Reset-MgUserAuthenticationMethodPassword -UserId $user_email -AuthenticationMethodId $method.id -NewPassword $password Reset-MgUserAuthenticationMethodPassword : Object reference not set to an instance of an object. At line:1 char:1

  • Reset-MgUserAuthenticationMethodPassword -UserId $user_email -Authe ...
  • CategoryInfo : NotSpecified: (:) [Reset-MgUserAut...d_ResetExpanded], NullReferenceException
  • FullyQualifiedErrorId : Microsoft.Graph.PowerShell.Cmdlets.ResetMgUserAuthenticationMethodPassword_ResetExpanded

Expected behavior

The script indeed reset the user password, however it always gives this error msg

Debug Output

Run the problematic command with -Debug and paste the resulting debug stream below. ⚠ ATTENTION: Be sure to remove any sensitive information that may be in the logs.

Reset-MgUserAuthenticationMethodPassword -UserId $user_email -AuthenticationMethodId $method.id -NewPassword $password -debug DEBUG: [CmdletBeginProcessing]: - Reset-MgUserAuthenticationMethodPassword begin processing with parameterSet 'ResetExpanded'. DEBUG: [Authentication]: - AuthType: 'Delegated', TokenCredentialType: 'InteractiveBrowser', ContextScope: 'Process', AppName: 'Microsoft Graph Command Line Tools'. DEBUG: [Authentication]: - Scopes: [AccessReview.Read.All, Agreement.Read.All, APIConnectors.Read.All, Directory.Read.All, Directory.ReadWrite.All, EntitlementManagement. Read.All, Group.ReadWrite.All, IdentityProvider.Read.All, IdentityUserFlow.Read.All, openid, Organization.Read.All, Policy.Read.All, Policy.Read.PermissionGrant, Privileg edAccess.Read.AzureAD, PrivilegedAccess.Read.AzureResources, profile, User.Read, User.Read.All, User.ReadWrite.All, UserAuthenticationMethod.Read.All, UserAuthenticationM ethod.ReadWrite.All, email]. DEBUG: ============================ HTTP REQUEST ============================

HTTP Method: POST

Absolute Uri: https://graph.microsoft.com/v1.0/users/xxxxxxxxxxxxxxxxx/authentication/methods/28c10230-6103-485e-b985-444c60001490/microsoft.graph.resetPassword

Headers: FeatureFlag : 00000043 Cache-Control : no-store, no-cache User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.19044; en-US),PowerShell/5.1.19041.3031 Accept-Encoding : gzip SdkVersion : graph-powershell/2.0.0 client-request-id : d5744dad-703e-4640-8c32-2aba6c7ed84c

Body: { "newPassword": "P@ssw0rd" }

DEBUG: ============================ HTTP RESPONSE ============================

Status Code: Accepted

Headers: Retry-After : 30 Strict-Transport-Security : max-age=31536000 request-id : ead25eda-341e-4d42-94d9-db5504c1dadc client-request-id : d5744dad-703e-4640-8c32-2aba6c7ed84c x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"West Europe","Slice":"E","Ring":"5","ScaleUnit":"005","RoleInstance":"AM4PEPF00015142"}} Date : Fri, 04 Aug 2023 13:39:30 GMT Location : https://graph.microsoft.com/v1.0/users/a6e6f127-c5ac-4f12-94c0-a9f11d0a93b1/authentication/operations/f4fb25ee-36f9-439a-8e7c-95e1a3a48b91 ?aadgdc=AM4P&aadgsu=ssprprod-a

Body:

DEBUG: [CmdletException]: Received exception with message 'NullReferenceException - Object reference not set to an instance of an object. : at Microsoft.Graph.PowerShe ll.Cmdlets.ResetMgUserAuthenticationMethodPassword_ResetExpanded.d64.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Graph.PowerShell.UsersActions.d__6.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.Graph.PowerShell.UsersActions.d6.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Graph.PowerShell.UsersActions.d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Graph.PowerShell.Cmdlets.ResetMgUserAuthenticationMethodPassword_ResetExpanded.d__61.MoveNext()' Reset-MgUserAuthenticationMethodPassword : Object reference not set to an instance of an object. At line:1 char:1

DEBUG: [CmdletEndProcessing]: - Reset-MgUserAuthenticationMethodPassword end processing.

Module Version

Please run Get-Module Microsoft.Graph* after cmdlet execution and paste the output below. If a module cannot be installed or imported, please run Get-Module -ListAvailable and paste the output.

PS C:\Users\ahmad.osman> Get-Module Microsoft.Graph

PS C:\Users\ahmad.osman> Get-Module -ListAvailable

Directory: C:\Users\ahmad.osman\OneDrive - Canon EMEA\OLD\Documents\WindowsPowerShell\Modules

ModuleType Version Name ExportedCommands


Script 2.0.0 Microsoft.Graph.Authentication {Connect-MgGraph, Disconnect-MgGraph, Get-MgContext, Invoke-MgGraphRequest...}
Script 2.0.0 Microsoft.Graph.Identity.SignIns {Confirm-MgRiskyServicePrincipalCompromised, Confirm-MgRiskyUserCompromised, Get-MgDataPolicyOperation, Get-... Script 2.0.0 Microsoft.Graph.Users {Get-MgUser, Get-MgUserCount, Get-MgUserCreatedObject, Get-MgUserCreatedObjectAsServicePrincipal...}
Script 2.0.0 Microsoft.Graph.Users.Actions {Add-MgUserChatMember, Add-MgUserDriveListContentTypeCopy, Add-MgUserDriveListContentTypeCopyFromContentType...

Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version Name ExportedCommands


Manifest 2.2.0 Microsoft.Graph
Script 2.2.0 Microsoft.Graph.Applications {Add-MgApplicationKey, Add-MgApplicationPassword, Add-MgServicePrincipalKey, Add-MgServicePrincipalPassword...} Script 2.1.0 Microsoft.Graph.Applications {Add-MgApplicationKey, Add-MgApplicationPassword, Add-MgServicePrincipalKey, Add-MgServicePrincipalPassword...} Script 2.2.0 Microsoft.Graph.Authentication {Connect-MgGraph, Disconnect-MgGraph, Get-MgContext, Invoke-MgGraphRequest...}
Script 2.1.0 Microsoft.Graph.Authentication {Connect-MgGraph, Disconnect-MgGraph, Get-MgContext, Invoke-MgGraphRequest...}
Script 2.2.0 Microsoft.Graph.Bookings {Get-MgBookingBusiness, Get-MgBookingBusinessAppointment, Get-MgBookingBusinessAppointmentCount, Get-MgBooki... Script 2.1.0 Microsoft.Graph.Bookings {Get-MgBookingBusiness, Get-MgBookingBusinessAppointment, Get-MgBookingBusinessAppointmentCount, Get-MgBooki... Script 2.2.0 Microsoft.Graph.Calendar {Get-MgGroupCalendar, Get-MgGroupCalendarEvent, Get-MgGroupCalendarPermission, Get-MgGroupCalendarPermission... Script 2.1.0 Microsoft.Graph.Calendar {Get-MgGroupCalendar, Get-MgGroupCalendarEvent, Get-MgGroupCalendarPermission, Get-MgGroupCalendarPermission... Script 2.2.0 Microsoft.Graph.ChangeNotifications {Get-MgSubscription, Invoke-MgReauthorizeSubscription, New-MgSubscription, Remove-MgSubscription...}
Script 2.1.0 Microsoft.Graph.ChangeNotifications {Get-MgSubscription, Invoke-MgReauthorizeSubscription, New-MgSubscription, Remove-MgSubscription...}
Script 2.2.0 Microsoft.Graph.CloudCommunications {Add-MgCommunicationCallLargeGalleryView, Clear-MgCommunicationPresence, Clear-MgCommunicationPresenceUserPr... Script 2.1.0 Microsoft.Graph.CloudCommunications {Add-MgCommunicationCallLargeGalleryView, Clear-MgCommunicationPresence, Clear-MgCommunicationPresenceUserPr... Script 2.2.0 Microsoft.Graph.Compliance {Get-MgCompliance, Get-MgPrivacySubjectRightsRequest, Get-MgPrivacySubjectRightsRequestCount, Get-MgPrivacyS... Script 2.1.0 Microsoft.Graph.Compliance {Get-MgCompliance, Get-MgPrivacySubjectRightsRequest, Get-MgPrivacySubjectRightsRequestCount, Get-MgPrivacyS... Script 2.2.0 Microsoft.Graph.CrossDeviceExper... {Get-MgUserActivity, Get-MgUserActivityCount, Get-MgUserActivityHistoryItem, Get-MgUserActivityHistoryItemAc... Script 2.1.0 Microsoft.Graph.CrossDeviceExper... {Get-MgUserActivity, Get-MgUserActivityCount, Get-MgUserActivityHistoryItem, Get-MgUserActivityHistoryItemAc... Script 2.2.0 Microsoft.Graph.DeviceManagement {Get-MgAdminEdge, Get-MgAdminEdgeInternetExplorerMode, Get-MgAdminEdgeInternetExplorerModeSiteList, Get-MgAd... Script 2.1.0 Microsoft.Graph.DeviceManagement {Get-MgAdminEdge, Get-MgAdminEdgeInternetExplorerMode, Get-MgAdminEdgeInternetExplorerModeSiteList, Get-MgAd... Script 2.2.0 Microsoft.Graph.DeviceManagement... {Clear-MgDeviceManagementManagedDevice, Disable-MgDeviceManagementManagedDeviceLostMode, Disconnect-MgDevice... Script 2.1.0 Microsoft.Graph.DeviceManagement... {Clear-MgDeviceManagementManagedDevice, Disable-MgDeviceManagementManagedDeviceLostMode, Disconnect-MgDevice... Script 2.2.0 Microsoft.Graph.DeviceManagement... {Get-MgDeviceManagementApplePushNotificationCertificate, Get-MgDeviceManagementAuditEvent, Get-MgDeviceManag... Script 2.1.0 Microsoft.Graph.DeviceManagement... {Get-MgDeviceManagementApplePushNotificationCertificate, Get-MgDeviceManagementAuditEvent, Get-MgDeviceManag... Script 2.2.0 Microsoft.Graph.DeviceManagement... {Get-MgDeviceManagementConditionalAccessSetting, Get-MgDeviceManagementDeviceEnrollmentConfiguration, Get-Mg... Script 2.1.0 Microsoft.Graph.DeviceManagement... {Get-MgDeviceManagementConditionalAccessSetting, Get-MgDeviceManagementDeviceEnrollmentConfiguration, Get-Mg... Script 2.2.0 Microsoft.Graph.DeviceManagement... {Confirm-MgDeviceManagementWindowsEnrollmentAutoDiscovery, Get-MgDeviceManagementAuditEventAuditActivityType... Script 2.1.0 Microsoft.Graph.DeviceManagement... {Confirm-MgDeviceManagementWindowsEnrollmentAutoDiscovery, Get-MgDeviceManagementAuditEventAuditActivityType... Script 2.2.0 Microsoft.Graph.Devices.CloudPrint {Get-MgPrint, Get-MgPrintConnector, Get-MgPrintConnectorCount, Get-MgPrintOperation...}
Script 2.1.0 Microsoft.Graph.Devices.CloudPrint {Get-MgPrint, Get-MgPrintConnector, Get-MgPrintConnectorCount, Get-MgPrintOperation...}
Script 2.2.0 Microsoft.Graph.Devices.Corporat... {Get-MgDeviceAppManagement, Get-MgDeviceAppManagementAndroidManagedAppProtection, Get-MgDeviceAppManagementA... Script 2.1.0 Microsoft.Graph.Devices.Corporat... {Get-MgDeviceAppManagement, Get-MgDeviceAppManagementAndroidManagedAppProtection, Get-MgDeviceAppManagementA... Script 2.2.0 Microsoft.Graph.Devices.ServiceA... {Get-MgServiceAnnouncementHealthOverview, Get-MgServiceAnnouncementHealthOverviewCount, Get-MgServiceAnnounc... Script 2.1.0 Microsoft.Graph.Devices.ServiceA... {Get-MgServiceAnnouncementHealthOverview, Get-MgServiceAnnouncementHealthOverviewCount, Get-MgServiceAnnounc... Script 2.2.0 Microsoft.Graph.DirectoryObjects {Confirm-MgDirectoryObjectMemberGroup, Confirm-MgDirectoryObjectMemberObject, Get-MgDirectoryObject, Get-MgD... Script 2.1.0 Microsoft.Graph.DirectoryObjects {Confirm-MgDirectoryObjectMemberGroup, Confirm-MgDirectoryObjectMemberObject, Get-MgDirectoryObject, Get-MgD... Script 2.2.0 Microsoft.Graph.Education {Get-MgEducationClass, Get-MgEducationClassAssignment, Get-MgEducationClassAssignmentCategory, Get-MgEducati... Script 2.1.0 Microsoft.Graph.Education {Get-MgEducationClass, Get-MgEducationClassAssignment, Get-MgEducationClassAssignmentCategory, Get-MgEducati... Script 2.2.0 Microsoft.Graph.Files {Add-MgDriveListContentTypeCopy, Add-MgDriveListContentTypeCopyFromContentTypeHub, Add-MgShareListContentTyp... Script 2.1.0 Microsoft.Graph.Files {Add-MgDriveListContentTypeCopy, Add-MgDriveListContentTypeCopyFromContentTypeHub, Add-MgShareListContentTyp... Script 2.2.0 Microsoft.Graph.Groups {Add-MgGroupDriveListContentTypeCopy, Add-MgGroupDriveListContentTypeCopyFromContentTypeHub, Add-MgGroupFavo... Script 2.1.0 Microsoft.Graph.Groups {Add-MgGroupDriveListContentTypeCopy, Add-MgGroupDriveListContentTypeCopyFromContentTypeHub, Add-MgGroupFavo... Script 2.2.0 Microsoft.Graph.Identity.Directo... {Confirm-MgContactMemberGroup, Confirm-MgContactMemberObject, Confirm-MgContractMemberGroup, Confirm-MgContr... Script 2.1.0 Microsoft.Graph.Identity.Directo... {Confirm-MgContactMemberGroup, Confirm-MgContactMemberObject, Confirm-MgContractMemberGroup, Confirm-MgContr... Script 2.2.0 Microsoft.Graph.Identity.Governance {Add-MgIdentityGovernanceAccessReviewDefinitionInstanceDecision, Get-MgAgreement, Get-MgAgreementAcceptance,... Script 2.1.0 Microsoft.Graph.Identity.Governance {Add-MgIdentityGovernanceAccessReviewDefinitionInstanceDecision, Get-MgAgreement, Get-MgAgreementAcceptance,... Script 2.2.0 Microsoft.Graph.Identity.Partner {Get-MgTenantRelationshipDelegatedAdminCustomer, Get-MgTenantRelationshipDelegatedAdminCustomerCount, Get-Mg... Script 2.1.0 Microsoft.Graph.Identity.Partner {Get-MgTenantRelationshipDelegatedAdminCustomer, Get-MgTenantRelationshipDelegatedAdminCustomerCount, Get-Mg... Script 2.2.0 Microsoft.Graph.Identity.SignIns {Confirm-MgRiskyServicePrincipalCompromised, Confirm-MgRiskyUserCompromised, Get-MgDataPolicyOperation, Get-... Script 2.1.0 Microsoft.Graph.Identity.SignIns {Confirm-MgRiskyServicePrincipalCompromised, Confirm-MgRiskyUserCompromised, Get-MgDataPolicyOperation, Get-... Script 2.2.0 Microsoft.Graph.Mail {Get-MgUserInferenceClassification, Get-MgUserInferenceClassificationOverride, Get-MgUserInferenceClassifica... Script 2.1.0 Microsoft.Graph.Mail {Get-MgUserInferenceClassification, Get-MgUserInferenceClassificationOverride, Get-MgUserInferenceClassifica... Script 2.2.0 Microsoft.Graph.Notes {Get-MgGroupOnenoteNotebook, Get-MgGroupOnenoteNotebookCount, Get-MgGroupOnenoteNotebookSection, Get-MgGroup... Script 2.1.0 Microsoft.Graph.Notes {Get-MgGroupOnenoteNotebook, Get-MgGroupOnenoteNotebookCount, Get-MgGroupOnenoteNotebookSection, Get-MgGroup... Script 2.2.0 Microsoft.Graph.People {Get-MgUserLastSharedMethodInsight, Get-MgUserPerson, Get-MgUserPersonCount, Get-MgUserSharedCountInsight...}
Script 2.1.0 Microsoft.Graph.People {Get-MgUserLastSharedMethodInsight, Get-MgUserPerson, Get-MgUserPersonCount, Get-MgUserSharedCountInsight...}
Script 2.2.0 Microsoft.Graph.PersonalContacts {Get-MgUserContact, Get-MgUserContactCount, Get-MgUserContactExtension, Get-MgUserContactExtensionCount...}
Script 2.1.0 Microsoft.Graph.PersonalContacts {Get-MgUserContact, Get-MgUserContactCount, Get-MgUserContactExtension, Get-MgUserContactExtensionCount...}
Script 2.2.0 Microsoft.Graph.Planner {Get-MgGroupPlanner, Get-MgGroupPlannerPlan, Get-MgGroupPlannerPlanBucket, Get-MgGroupPlannerPlanCount...}
Script 2.1.0 Microsoft.Graph.Planner {Get-MgGroupPlanner, Get-MgGroupPlannerPlan, Get-MgGroupPlannerPlanBucket, Get-MgGroupPlannerPlanCount...}
Script 2.2.0 Microsoft.Graph.Reports {Get-MgAuditLogDirectoryAudit, Get-MgAuditLogDirectoryAuditCount, Get-MgAuditLogProvisioning, Get-MgAuditLog... Script 2.1.0 Microsoft.Graph.Reports {Get-MgAuditLogDirectoryAudit, Get-MgAuditLogDirectoryAuditCount, Get-MgAuditLogProvisioning, Get-MgAuditLog... Script 2.2.0 Microsoft.Graph.SchemaExtensions {Get-MgSchemaExtension, Get-MgSchemaExtensionCount, New-MgSchemaExtension, Remove-MgSchemaExtension...}
Script 2.1.0 Microsoft.Graph.SchemaExtensions {Get-MgSchemaExtension, Get-MgSchemaExtensionCount, New-MgSchemaExtension, Remove-MgSchemaExtension...}
Script 2.2.0 Microsoft.Graph.Search {Add-MgExternalConnectionItemActivity, Get-MgExternal, Get-MgExternalConnection, Get-MgExternalConnectionCou... Script 2.1.0 Microsoft.Graph.Search {Add-MgExternalConnectionItemActivity, Get-MgExternal, Get-MgExternalConnection, Get-MgExternalConnectionCou... Script 2.2.0 Microsoft.Graph.Security {Add-MgSecurityCaseEdiscoveryCaseCustodianHold, Add-MgSecurityCaseEdiscoveryCaseNoncustodialDataSourceHold, ... Script 2.1.0 Microsoft.Graph.Security {Add-MgSecurityCaseEdiscoveryCaseCustodianHold, Add-MgSecurityCaseEdiscoveryCaseNoncustodialDataSourceHold, ... Script 2.2.0 Microsoft.Graph.Sites {Add-MgSite, Add-MgSiteContentTypeCopy, Add-MgSiteContentTypeCopyFromContentTypeHub, Add-MgSiteListContentTy... Script 2.1.0 Microsoft.Graph.Sites {Add-MgSite, Add-MgSiteContentTypeCopy, Add-MgSiteContentTypeCopyFromContentTypeHub, Add-MgSiteListContentTy... Script 2.2.0 Microsoft.Graph.Teams {Add-MgChatMember, Add-MgTeamChannelMember, Add-MgTeamMember, Add-MgTeamPrimaryChannelMember...}
Script 2.1.0 Microsoft.Graph.Teams {Add-MgChatMember, Add-MgTeamChannelMember, Add-MgTeamMember, Add-MgTeamPrimaryChannelMember...}
Script 2.2.0 Microsoft.Graph.Users {Get-MgUser, Get-MgUserCount, Get-MgUserCreatedObject, Get-MgUserCreatedObjectAsServicePrincipal...}
Script 2.1.0 Microsoft.Graph.Users {Get-MgUser, Get-MgUserCount, Get-MgUserCreatedObject, Get-MgUserCreatedObjectAsServicePrincipal...}
Script 2.2.0 Microsoft.Graph.Users.Actions {Add-MgUserChatMember, Add-MgUserDriveListContentTypeCopy, Add-MgUserDriveListContentTypeCopyFromContentType... Script 2.1.0 Microsoft.Graph.Users.Actions {Add-MgUserChatMember, Add-MgUserDriveListContentTypeCopy, Add-MgUserDriveListContentTypeCopyFromContentType... Script 2.2.0 Microsoft.Graph.Users.Functions {Export-MgUserDeviceAndAppManagementData, Get-MgAllUserChatMessage, Get-MgUserCalendarEventDelta, Get-MgUser... Script 2.1.0 Microsoft.Graph.Users.Functions {Export-MgUserDeviceAndAppManagementData, Get-MgAllUserChatMessage, Get-MgUserCalendarEventDelta, Get-MgUser... Script 1.0.1 Microsoft.PowerShell.Operation.V... {Get-OperationValidation, Invoke-OperationValidation}
Binary 1.0.0.1 PackageManagement {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}
Script 3.4.0 Pester {Describe, Context, It, Should...}
Script 1.0.0.1 PowerShellGet {Install-Module, Find-Module, Save-Module, Update-Module...}
Script 2.0.0 PSReadline {Get-PSReadLineKeyHandler, Set-PSReadLineKeyHandler, Remove-PSReadLineKeyHandler, Get-PSReadLineOption...}

Directory: C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules

ModuleType Version Name ExportedCommands


Manifest 1.0.0.0 AppBackgroundTask {Disable-AppBackgroundTaskDiagnosticLog, Enable-AppBackgroundTaskDiagnosticLog, Set-AppBackgroundTaskResourc... Manifest 2.0.0.0 AppLocker {Get-AppLockerFileInformation, Get-AppLockerPolicy, New-AppLockerPolicy, Set-AppLockerPolicy...}
Manifest 1.0.0.0 AppvClient {Add-AppvClientConnectionGroup, Add-AppvClientPackage, Add-AppvPublishingServer, Disable-Appv...}
Manifest 2.0.1.0 Appx {Add-AppxPackage, Get-AppxPackage, Get-AppxPackageManifest, Remove-AppxPackage...}
Script 1.0.0.0 AssignedAccess {Clear-AssignedAccess, Get-AssignedAccess, Set-AssignedAccess}
Manifest 1.0.0.0 BitLocker {Unlock-BitLocker, Suspend-BitLocker, Resume-BitLocker, Remove-BitLockerKeyProtector...}
Manifest 2.0.0.0 BitsTransfer {Add-BitsFile, Complete-BitsTransfer, Get-BitsTransfer, Remove-BitsTransfer...}
Manifest 1.0.0.0 BranchCache {Add-BCDataCacheExtension, Clear-BCCache, Disable-BC, Disable-BCDowngrading...}
Manifest 1.0.0.0 CimCmdlets {Get-CimAssociatedInstance, Get-CimClass, Get-CimInstance, Get-CimSession...}
Manifest 1.0 ConfigCI {Get-SystemDriver, New-CIPolicyRule, New-CIPolicy, Get-CIPolicy...}
Manifest 1.0 ConfigDefender {Get-MpPreference, Set-MpPreference, Add-MpPreference, Remove-MpPreference...}
Manifest 1.0 ConfigDefenderPerformance {New-MpPerformanceRecording, Get-MpPerformanceReport}
Manifest 1.0 Defender {Get-MpPreference, Set-MpPreference, Add-MpPreference, Remove-MpPreference...}
Manifest 1.0.2.0 DeliveryOptimization {Delete-DeliveryOptimizationCache, Set-DeliveryOptimizationStatus, Get-DeliveryOptimizationLog, Get-Delivery... Manifest 1.0.0.0 DirectAccessClientComponents {Disable-DAManualEntryPointSelection, Enable-DAManualEntryPointSelection, Get-DAClientExperienceConfiguratio... Script 3.0 Dism {Add-AppxProvisionedPackage, Add-WindowsDriver, Add-WindowsCapability, Add-WindowsImage...}
Manifest 1.0.0.0 DnsClient {Resolve-DnsName, Clear-DnsClientCache, Get-DnsClient, Get-DnsClientCache...}
Manifest 1.0.0.0 EventTracingManagement {Start-EtwTraceSession, New-EtwTraceSession, Get-EtwTraceSession, Update-EtwTraceSession...}
Manifest 1.0.0.0 HgsClient {Get-HgsAttestationBaselinePolicy, Get-HgsClientConfiguration, Test-HgsClientConfiguration, Set-HgsClientCon... Manifest 1.0.0.0 HgsDiagnostics {New-HgsTraceTarget, Get-HgsTrace, Get-HgsTraceFileData, Test-HgsTraceTarget}
Manifest 1.0.0.1 HostNetworkingService {Remove-HnsNamespace, Remove-HnsEndpoint, Get-HnsEndpoint, Remove-HnsPolicyList...}
Binary 2.0.0.0 Hyper-V {Add-VMAssignableDevice, Add-VMDvdDrive, Add-VMFibreChannelHba, Add-VMGpuPartitionAdapter...}
Binary 1.1 Hyper-V {Add-VMDvdDrive, Add-VMFibreChannelHba, Add-VMHardDiskDrive, Add-VMMigrationNetwork...}
Manifest 2.0.0.0 International {Get-WinDefaultInputMethodOverride, Set-WinDefaultInputMethodOverride, Get-WinHomeLocation, Set-WinHomeLocat... Manifest 1.0.0.0 iSCSI {Get-IscsiTargetPortal, New-IscsiTargetPortal, Remove-IscsiTargetPortal, Update-IscsiTargetPortal...}
Script 1.0.0.0 ISE {New-IseSnippet, Import-IseSnippet, Get-IseSnippet}
Manifest 1.0.0.0 Kds {Add-KdsRootKey, Get-KdsRootKey, Test-KdsRootKey, Set-KdsConfiguration...}
Manifest 1.0 LanguagePackManagement {Install-Language, Uninstall-Language, Get-InstalledLanguage, Set-SystemPreferredUILanguage...}
Script 1.0.0.0 LAPS {Find-LapsADExtendedRights, Get-LapsADPassword, Invoke-LapsPolicyProcessing, Reset-LapsPassword...}
Manifest 1.0.1.0 Microsoft.PowerShell.Archive {Compress-Archive, Expand-Archive}
Manifest 3.0.0.0 Microsoft.PowerShell.Diagnostics {Get-WinEvent, Get-Counter, Import-Counter, Export-Counter...}
Manifest 3.0.0.0 Microsoft.PowerShell.Host {Start-Transcript, Stop-Transcript}
Manifest 1.0.0.0 Microsoft.PowerShell.LocalAccounts {Add-LocalGroupMember, Disable-LocalUser, Enable-LocalUser, Get-LocalGroup...}
Manifest 3.1.0.0 Microsoft.PowerShell.Management {Add-Content, Clear-Content, Clear-ItemProperty, Join-Path...}
Script 1.0 Microsoft.PowerShell.ODataUtils Export-ODataEndpointProxy
Manifest 3.0.0.0 Microsoft.PowerShell.Security {Get-Acl, Set-Acl, Get-PfxCertificate, Get-Credential...}
Manifest 3.1.0.0 Microsoft.PowerShell.Utility {Format-List, Format-Custom, Format-Table, Format-Wide...}
Manifest 3.0.0.0 Microsoft.WSMan.Management {Disable-WSManCredSSP, Enable-WSManCredSSP, Get-WSManCredSSP, Set-WSManQuickConfig...}
Manifest 1.0 MMAgent {Disable-MMAgent, Enable-MMAgent, Set-MMAgent, Get-MMAgent...}
Manifest 1.0.0.0 MsDtc {New-DtcDiagnosticTransaction, Complete-DtcDiagnosticTransaction, Join-DtcDiagnosticResourceManager, Receive... Manifest 2.0.0.0 NetAdapter {Disable-NetAdapter, Disable-NetAdapterBinding, Disable-NetAdapterChecksumOffload, Disable-NetAdapterEncapsu... Manifest 2.0.0.0 NetConnection {Get-NetConnectionProfile, Set-NetConnectionProfile}
Manifest 1.0.0.0 NetEventPacketCapture {New-NetEventSession, Remove-NetEventSession, Get-NetEventSession, Set-NetEventSession...}
Manifest 2.0.0.0 NetLbfo {Add-NetLbfoTeamMember, Add-NetLbfoTeamNic, Get-NetLbfoTeam, Get-NetLbfoTeamMember...}
Manifest 1.0.0.0 NetNat {Get-NetNat, Get-NetNatExternalAddress, Get-NetNatStaticMapping, Get-NetNatSession...}
Manifest 2.0.0.0 NetQos {Get-NetQosPolicy, Set-NetQosPolicy, Remove-NetQosPolicy, New-NetQosPolicy}
Manifest 2.0.0.0 NetSecurity {Get-DAPolicyChange, New-NetIPsecAuthProposal, New-NetIPsecMainModeCryptoProposal, New-NetIPsecQuickModeCryp... Manifest 1.0.0.0 NetSwitchTeam {New-NetSwitchTeam, Remove-NetSwitchTeam, Get-NetSwitchTeam, Rename-NetSwitchTeam...}
Manifest 1.0.0.0 NetTCPIP {Get-NetIPAddress, Get-NetIPInterface, Get-NetIPv4Protocol, Get-NetIPv6Protocol...}
Manifest 1.0.0.0 NetworkConnectivityStatus {Get-DAConnectionStatus, Get-NCSIPolicyConfiguration, Reset-NCSIPolicyConfiguration, Set-NCSIPolicyConfigura... Manifest 1.0.0.0 NetworkSwitchManager {Disable-NetworkSwitchEthernetPort, Enable-NetworkSwitchEthernetPort, Get-NetworkSwitchEthernetPort, Remove-... Manifest 1.0.0.0 NetworkTransition {Add-NetIPHttpsCertBinding, Disable-NetDnsTransitionConfiguration, Disable-NetIPHttpsProfile, Disable-NetNat... Manifest 1.0.0.0 PcsvDevice {Get-PcsvDevice, Start-PcsvDevice, Stop-PcsvDevice, Restart-PcsvDevice...}
Binary 1.0.0.0 PersistentMemory {Get-PmemDisk, Get-PmemPhysicalDevice, Get-PmemUnusedRegion, New-PmemDisk...}
Manifest 1.0.0.0 PKI {Add-CertificateEnrollmentPolicyServer, Export-Certificate, Export-PfxCertificate, Get-CertificateAutoEnroll... Manifest 1.0.0.0 PnpDevice {Get-PnpDevice, Get-PnpDeviceProperty, Enable-PnpDevice, Disable-PnpDevice}
Manifest 1.1 PrintManagement {Add-Printer, Add-PrinterDriver, Add-PrinterPort, Get-PrintConfiguration...}
Binary 1.0.12 ProcessMitigations {Get-ProcessMitigation, Set-ProcessMitigation, ConvertTo-ProcessMitigationPolicy}
Script 3.0 Provisioning {Install-ProvisioningPackage, Export-ProvisioningPackage, Install-TrustedProvisioningCertificate, Export-Tra... Manifest 1.1 PSDesiredStateConfiguration {Set-DscLocalConfigurationManager, Start-DscConfiguration, Test-DscConfiguration, Publish-DscConfiguration...} Script 1.0.0.0 PSDiagnostics {Disable-PSTrace, Disable-PSWSManCombinedTrace, Disable-WSManTrace, Enable-PSTrace...}
Binary 1.1.0.0 PSScheduledJob {New-JobTrigger, Add-JobTrigger, Remove-JobTrigger, Get-JobTrigger...}
Manifest 2.0.0.0 PSWorkflow {New-PSWorkflowExecutionOption, New-PSWorkflowSession, nwsn}
Manifest 1.0.0.0 PSWorkflowUtility Invoke-AsWorkflow
Manifest 1.0.0.0 ScheduledTasks {Get-ScheduledTask, Set-ScheduledTask, Register-ScheduledTask, Unregister-ScheduledTask...}
Manifest 2.0.0.0 SecureBoot {Confirm-SecureBootUEFI, Set-SecureBootUEFI, Get-SecureBootUEFI, Format-SecureBootUEFI...}
Manifest 2.0.0.0 SmbShare {Get-SmbShare, Remove-SmbShare, Set-SmbShare, Block-SmbShareAccess...}
Manifest 2.0.0.0 SmbWitness {Get-SmbWitnessClient, Move-SmbWitnessClient, gsmbw, msmbw...}
Manifest 1.0.0.2 StartLayout {Export-StartLayout, Import-StartLayout, Export-StartLayoutEdgeAssets, Get-StartApps}
Manifest 2.0.0.0 Storage {Add-InitiatorIdToMaskingSet, Add-PartitionAccessPath, Add-PhysicalDisk, Add-StorageFaultDomain...}
Manifest 1.0.0.0 StorageBusCache {Clear-StorageBusDisk, Disable-StorageBusCache, Disable-StorageBusDisk, Enable-StorageBusCache...}
Manifest 2.0.0.0 TLS {New-TlsSessionTicketKey, Enable-TlsSessionTicketKey, Disable-TlsSessionTicketKey, Export-TlsSessionTicketKe... Manifest 1.0.0.0 TroubleshootingPack {Get-TroubleshootingPack, Invoke-TroubleshootingPack}
Manifest 2.0.0.0 TrustedPlatformModule {Get-Tpm, Initialize-Tpm, Clear-Tpm, Unblock-Tpm...}
Binary 2.1.639.0 UEV {Clear-UevConfiguration, Clear-UevAppxPackage, Restore-UevBackup, Set-UevTemplateProfile...}
Manifest 2.0.0.0 VpnClient {Add-VpnConnection, Set-VpnConnection, Remove-VpnConnection, Get-VpnConnection...}
Manifest 1.0.0.0 Wdac {Get-OdbcDriver, Set-OdbcDriver, Get-OdbcDsn, Add-OdbcDsn...}
Manifest 2.0.0.0 Whea {Get-WheaMemoryPolicy, Set-WheaMemoryPolicy}
Manifest 1.0.0.0 WindowsDeveloperLicense {Get-WindowsDeveloperLicense, Unregister-WindowsDeveloperLicense, Show-WindowsDeveloperLicenseRegistration}
Script 1.0 WindowsErrorReporting {Enable-WindowsErrorReporting, Disable-WindowsErrorReporting, Get-WindowsErrorReporting}
Manifest 1.0.0.0 WindowsSearch {Get-WindowsSearchSetting, Set-WindowsSearchSetting}
Manifest 1.0.0.0 WindowsUpdate Get-WindowsUpdateLog

Directory: C:\Program Files (x86)\Microsoft Azure Information Protection\Powershell

ModuleType Version Name ExportedCommands


Binary 2.13.49.0 AzureInformationProtection {Start-AIPScannerDiagnostics, Get-MIPNetworkDiscoveryStatus, Get-MIPNetworkDiscoveryConfiguration, Clear-AIP...

PS C:\Users\ahmad.osman>

Environment Data

Please run $PSVersionTable and paste the output below. If running the Docker container image, indicate the tag of the image used and the version of Docker engine.

PS C:\Users\ahmad.osman> $PSVersionTable

Name Value


PSVersion 5.1.19041.3031
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.3031
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

PS C:\Users\ahmad.osman> Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

peombwa commented 1 year ago

Thanks for following up on this.

This is a duplicate of https://github.com/microsoftgraph/msgraph-sdk-powershell/issues/2191#issuecomment-1662690070. The fix is scheduled to go out somewhere this week as part of v2.3.0.

As a workaround, please use the standalone PowerShell 5.1 (not VS Code extension) or PowerShell 7 to run the command.

AhmadOsman commented 1 year ago

Hi team,

BTW the issue is still there, even after the last update

PS C:\Users\ahmad.osman> Get-InstalledModule Microsoft.Graph

Version Name Repository Description


2.4.0 Microsoft.Graph PSGallery Microsoft Graph PowerShell module

PS C:\Users\ahmad.osman> $user_email = 'joep.@xxxxx.fi'

PS C:\Users\ahmad.osman> $method = Get-MgUserAuthenticationPasswordMethod -UserId $user_email

PS C:\Users\ahmad.osman> $password = 'Pass@word1'

PS C:\Users\ahmad.osman> Reset-MgUserAuthenticationMethodPassword -UserId $user_email -AuthenticationMethodId $method.id -NewPassword $password Reset-MgUserAuthenticationMethodPassword : Object reference not set to an instance of an object. At line:1 char:1

AhmadOsman commented 1 year ago

Hi all,

As an update. The issue has been fixed now.

You need to run this command; Get-Module -ListAvailable to know where Microsoft.Graph modules are installed, and make sure there is no remaining old modules in e.g. C:\Program Files\WindowsPowerShell\Modules

In another meaning, don't only uninstall-module Microsoft.Graph but also delete all folders, and install it again.