0 votes

Hi,

I'm trying to put together a new script using MSGraph which allows users to reset MFA via Adaxes. The script works fine in PowerShell ISE on the Adaxes hosted server. However, when attempting to run in Adaxes as a custom command I keep receiving module errors. First it suggests that I import the module into the session, then after doing so it says the module could not be loaded and therefore the cmdlets aren't recognised.

I can confirm that the required modules are installed on the server.

Any suggestions would be greatly appreciated.

ago by (370 points)
0

Hello,

For troubleshooting purposes, please, post here or send us (support@adaxes.com) the script in TXT format.

Also, please, post here or send us a screenshot of the Multi-server environment dialog. The dialog displays how many Adaxes services you have and what their versions are. For information on how to view it, see https://www.adaxes.com/help/MultiServerEnvironment. Finally, please, post here or send us a screenshot of the error you face.

0

Hi,

Thanks for to the quick reply.

Here is the script in it's simplest form. The full script contains the reset of every method. Currently testing with the phone number only at the moment:

"$azureID = $Context.TargetObject.AzureID if ($NULL -eq $azureID) { $Context.LogMessage("The user does not have a Microsoft 365 account", "Warning") return } $accessToken = $Context.CloudServices.GetAzureAuthAccessToken() Connect-MgGraph -AccessToken ($accessToken | ConvertTo-SecureString -AsPlainText -Force)

$methods = Get-MgUserAuthenticationPhoneMethod -UserId $azureId foreach ($method in $methods) { Remove-MgUserAuthenticationPhoneMethod -UserId $azureId -PhoneAuthenticationMethodId $method.Id }"

Error message when executing.

"The 'Get-MgUserAuthenticationPhoneMethod' command was found in the module 'Microsoft.Graph.Identity.SignIns', but the module could not be loaded. For more information, run 'Import-Module Microsoft.Graph.Identity.SignIns'. Stack trace: at <ScriptBlock>, <No file>: line 16"

If I add the import-module cmd into the script I then get this:

image.png image.png

Here is a screenshot of the MultiServerEnvironment:

image.png

Thank you

0

Hello,

For further troubleshooting, please, execute the below command in Windows PowerShell on the computer where Adaxes service runs and post here or send us (support@adaxes.com) a screenshot of the output.

Get-InstalledModule -Name "Microsoft.Graph*"
0

image.png

1 Answer

0 votes
ago by (305k points)

Hello,

Thank you for the provided details. Unfortunately, there are known issues in case different versions of the Microsoft Graph PowerShell module are installed. To resolve the issue, please, do the following:

  1. Execute the below command on one of the computers where Adaxes service runs.
    Get-InstalledModule Microsoft.Graph.* | ? Name -ne "Microsoft.Graph.Authentication" | Uninstall-Module -AllVersions
    Uninstall-Module Microsoft.Graph.Authentication -AllVersions
  2. Execute the below command on one of the computers where Adaxes service runs.
    Install-Module Microsoft.Graph 
  3. Restart the Softerra Adaxes Service Windows service.
  4. Repeat steps 1-3 on the second computer where Adaxes service runs.
0

This fixed the issue. Thank you very much for the help

Related questions

0 votes
0 answers

Hello there, We have guest accounts created in AD (on our DMZ DC) that use the first initial + last name format for username with the last 4 digits of their mobile ... there any special way I should be updating a username and UPN from PowerShell? Thanks, Chris

asked Jul 13, 2018 by Bowman4864 (270 points)
0 votes
0 answers

Hi, I'm currently working with setting up a new Adaxes solution for a customer at my company. The customer needs a solution that can add a security group with full ... help me out here :-) That would be greatly appreciated. Best Regards, Kristoffer Høie.

asked Jun 29, 2016 by krihoie (20 points)
0 votes
1 answer

Hi, I need to create a number of mail user accounts via Adaxes and a lot of these accounts have &amp; in the displayname/email address etc (I know, I know ... failed so I can troubleshoot it better. I have tried $context.logmessage($_.Exception.Message) Thanks

asked May 9, 2024 by typod (50 points)
0 votes
1 answer

Hello Again, We are experiencing a few issues with Exchange 2003: - When the primary mail address is changed, the mail attribute is not updated I could workarround ... uncommited data would solve this issue and add flexibility. Thank you in advance Pierre

asked Sep 13, 2013 by Pierre (750 points)
0 votes
1 answer

Hi all, We have an error in our 365 licenses that wont let the ... " -LicenseOptions $EcalLicense Remove-PSSession $Session ##################################################################################################################################

asked Aug 29, 2017 by will17 (350 points)
3,733 questions
3,411 answers
8,631 comments
550,226 users