0 votes

Hi all,

We currently have a bunch of dial plans that we assign to new users via Adaxes. We updated Adaxes to the latest version, and moved it to a new server before the end of the year, alongside adding our Azure AD domain to try and manage that as well. It seems like during this (or conveniently around the same time), the scripts have broken and no longer do anything.

During user creation, we use extension attribute 1 and 2 - 1 is 'TeamsIncomplete', and 2 is the user's extension. Once these scripts run successfully, they are supposed to set these values to null.

The script is as follows:

# Get saved credentials
$username = $Context.RunAs.UserName
$password = $Context.RunAs.Password | ConvertTo-SecureString -AsPlainText -Force
$credential = New-Object System.Management.Automation.PsCredential($username, $password)

try
{
    # Get the object ID in Microsoft 365
    $objectId = ([Guid]$Context.TargetObject.Get("adm-O365ObjectId")).ToString()
}
catch
{
    return # The user doesn't have a Microsoft 365 account
}

try
{
    # Get the user in Microsoft Teams
    Connect-MicrosoftTeams -Credential $credential
    $user = Get-CsOnlineUser -Filter "Identity -eq '$objectId'"

    if ($NULL -eq $user)
    {
        $Context.LogMessage("The user does not have a Microsoft Teams account", "Information")
        return # User does not exist in Microsoft Teams
    }
   #Set-CsUser -Identity $user.Identity -EnterpriseVoiceEnabled $true -HostedVoiceMail $true
   #25/07/22 - Removed the above line to replace with one that enables Enterprise Voice and adds an phonenumber and extension
   #to enable transferring teams calls to PSTN lines
   #The "-EnterpriseVoiceEnabled" flag is no longer required, as it is automatically included when a phone number is added.

   Set-CsPhoneNumberAssignment -Identity $user.Identity -PhoneNumber "+555-5555-555;ext=%extensionAttribute2%" -Phonenumbertype DirectRouting
   Grant-CsOnlineVoiceRoutingPolicy -Identity $user.Identity -PolicyName “Worldwide”
   Grant-CsCallingLineIdentity -Identity $user.Identity -PolicyName "No DDI"

#Clear ExtensionAttribute1 (Teams configuration flag) to indicate Teams is now configured
#25/07/22 - Added Extensionattribute2 (Teams Extension) as well.
   $context.Targetobject.put("extensionAttribute1", $null)
   $context.TargetObject.Put("extensionAttribute2", $null)
   $context.Targetobject.Setinfo() 
}
finally
{
    # Close the connection and release resources
    Disconnect-MicrosoftTeams
}

At the moment, the script runs each night on the same users, as it seems the script is failing early on in the process. Manually running it, it runs for around 12 seconds, then stops - there are no errors in the management/execution log - it only shows that the scripts run for the same users every time.

Can anyone advise if this script should still work? If so, perhaps there is some other issue with Adaxes causing this?

When attempting to view the 'resolved value references' for an account, the 'adm-o365objectid' doesn't change into a value - perhaps this value has been removed/broken in new versions of adaxes?

Cheers all.

related to an answer for: How to connect to MS Teams using Adaxes
by (200 points)
0

Hello,

there are no errors in the management/execution log - it only shows that the scripts run for the same users every time.

Are you sure there are no errors/warnings in the logs? Please, try checking via the general log. The following tutorial will be helpful: https://www.adaxes.com/help/ViewOperationsPerformedViaAdaxes. If you find something, please, post here or send us (support@adaxes.com) screenshots.

When attempting to view the 'resolved value references' for an account, the 'adm-o365objectid' doesn't change into a value - perhaps this value has been removed/broken in new versions of adaxes?

There are no value references in the script and thus the behaviour is expected.

0

Hi team,

Correct - the execution log shows the script ran for each pending user, but produced no errors.

no errors.png

I suspect it's not picking up that the user has an Office365 account in this section:

try
{
    # Get the object ID in Microsoft 365
    $objectId = ([Guid]$Context.TargetObject.Get("adm-O365ObjectId")).ToString()
}
catch
{
    return # The user doesn't have a Microsoft 365 account
}

try
{

Strangely, I edited the script to try and reproduce the errors I got yesterday after copying the context.logmessage entry into the catch { return } section, but now every time I run the script it says 'running' for 2 seconds, then stops, but doesn't show that it ran in the logs at all - wonder if I've somehow broken Adaxes entirely with this :D

1 Answer

0 votes
by (288k points)

Hello,

We recommend you to just use the most up to date approach for connecting to Microsoft Teams: https://www.adaxes.com/script-repository/connect-to-microsoft-teams-s615.htm.

Related questions

0 votes
1 answer

Users when signing into the adaxes portal, MFA keeps saying invalid. I have had to disable MFA for now till we can get this resolved.

asked Jul 18 by imagee (20 points)
0 votes
0 answers

Hi all, We had patches installed on our Adaxes 2018.2, 2008 R2 server the other night. As part of that, Windows Management Framework ... -44db-b83c-3a0696611ddd/could-not-load-file-or-assembly-systemmanagementautomation-version3000?forum=virtualmachinemanager

asked Sep 26, 2019 by AllianceIT (130 points)
0 votes
0 answers

Hi all, We have Adaxes running in our environment. We don't have an on-prem Exchange environment, everything is in Exchange online. Our existing distrubution groups all ... how to get the exchange properties back for newly created groups? Kind regards, Eddy

asked Dec 8, 2022 by eddy1985 (20 points)
0 votes
1 answer

We have a Business rule that runs after successful user creation. It creates a EULA Word doc with the username and initial password for the new user. It was originally set as a ... , and I don't believe any changes have been made to the Adaxes setup...

asked Jul 8, 2020 by johnsonua (390 points)
0 votes
1 answer

So I need to export a list of all user's Line URI's to a CSV file. Running Adaxes 2021 Version 3.14.18804.0 (64 bit) and Teams Powershell 4.1.0 ... a Microsoft 365 account } finally { # Close the connection and release resources Disconnect-MicrosoftTeams }

asked Aug 4, 2022 by TheLexicon (200 points)
3,542 questions
3,233 answers
8,227 comments
547,807 users