Hi
When we try to run the below script within adaxes, we get the following error:
Running the script in powershell works fine without errors.
Import-Module MicrosoftTeams
#M365
$msuser = '%username%@xyz.ch'
#Numbers
$pathFree = "C:\adaxes-scripts\phonesystem\free"
$pathUsed = "C:\adaxes-scripts\phonesystem\used"
#Encryption
$credentialFilePath = 'C:\adaxes-scripts\phonesystem\msteams-SecureStore.txt'
$SecurePwdFilePath = 'C:\adaxes-scripts\phonesystem\msteams-SecureStorePW.txt'
$AESKeyFilePath = 'C:\adaxes-scripts\phonesystem\msteams-AES.key'
$credFiles = Get-Content $credentialFilePath
$username = "admin@xyz.onmicrosoft.com"
$AESKey = Get-Content $AESKeyFilePath
$pwdTxt = Get-Content $SecurePwdFilePath
$securePwd = $pwdTxt | ConvertTo-SecureString -Key $AESKey
#Create M365 Login Credential
$msCred = New-Object System.Management.Automation.PSCredential -ArgumentList $userName, $securePwd
#Connect to M365
Connect-MicrosoftTeams -credential $msCred
$phone = Get-CsOnlineUser -Identity $msuser | select -expand LineUri
$Context.LogMessage("$phone", "Information")
if($phone -ne "") {
#$phone = $phone.TrimStart('')
$Context.LogMessage("$phone", "Information")
$usedNumberFile = $pathUsed+'\'+$phone+'.txt'
$Context.LogMessage("$usedNumberFile", "Information")
Move-Item $usedNumberFile -Destination $pathFree -force
}
Disconnect-MicrosoftTeams
Clear-Variable -name phone
Clear-Variable -name usedNumberFile
Clear-Variable -name msCred
Any ideas why Adaxes doesnt liek that script? Thanks