Closed S-Mellado closed 1 year ago
Hi, I have the same problem. How can I fix it? Thanks for your support!
Hi, review Get-GALContacts.ps1 script and in the line Connect-ExchangeOnline -ConnectionUri $ConnectionUri -CertificateFilePath $CertificatePath -CertificatePassword $CertificatePassword -AppId $ClientID -Organization $ExchangeOrg add this parameter -UseRPSSession like this: Connect-ExchangeOnline -UseRPSSession -ConnectionUri $ConnectionUri -CertificateFilePath $CertificatePath -CertificatePassword $CertificatePassword -AppId $ClientID -Organization $ExchangeOrg
Let me know if all is ok.
Hi and thanks, unfortunately it does not change
Do you review the permission on the azure app?
Yes:
Try this. Change the .bat by powershell. Forget .bat. Open powershell and call to your ps1. See txt Script_Contacts_To_One_Mailbox.txt
Try this. Change the .bat by powershell. Forget .bat. Open powershell and call to your ps1, like this:
$CertificatePath = "C:\Admin\Scripts\Contacts_New\Certificados\Certificate.pfx" $CertificatePasswordPath = "C:\Admin\Scripts\Contacts_New\Getting Started\SecureCertificatePassword.xml" $ClientID = "CLientID" (write your client id) $FolderContacName = "FolderName" $LogPath = "%~dp0Logs" $ExchangeOrg = "contoso.onmicrosoft.com" function Get-Buzon { param ( MailBox=( Write-Host ' ' Write-Host '* SCRIPT CONTACTOS ** ' Write-Host ' ' Write-Host 'Script para desplegar los contactos de la compañía sobre el buzón de un usuario ' Write-Host 'Se guardarán en una carpeta de los contactos del usuario llamada Deoleo Mobile' Write-Host ' ' Write-Host '*** ' Write-Host ' ' Write-Host 'Introduzca el buzón del usuario: '-ForegroundColor Yellow -NoNewLine Read-Host ) ) $MailBox } $MailBox = Get-Buzon
C:\Admin\Scripts\Contacts_New\EWSContactSync.ps1 -CertificatePath $CertificatePath -CertificatePasswordPath $CertificatePasswordPath -ClientID $ClientID -FolderName $FolderContacName -LogPath $LogPath -MailboxList $MailBox -ExchangeOrg $ExchangeOrg -ModernAuth**
I'm sorry but I didn't understand how to proceed
@Manuel-Yotta Can you try to change your system language to English so see if this resolves your issue? I've not tested the script in other languages.
@Manuel-Yotta Can you try to change your system language to English so see if this resolves your issue? I've not tested the script in other languages.
It is the same
@Manuel-Yotta @S-Mellado
It looks like you exported your certificate password using "Get-Credential". You need to instead use "Read-Host -AsSecureString" to export the password. See below for an example. I think this will resolve your issue.
# interactively prompt for the certificate password as a secure string
$SecureString = Read-Host -AsSecureString
# export the secret string object to a file
$SecureString | Export-Clixml .\SecureCertificatePassword.cred
# interactively prompt for the certificate password as a secure string
perfect, I confirm that this solution is decisive. Thanks so much everyone for the support and congratulations again for the script!!!
Reported as solved, closing issue...
I have problem when I execute .bat, the error message said Cannot convert the "System.Management.Automation.PSCredential" value of type "System.Management.Automation.PSCredential" to type "System.Security.SecureString". I think my problem is with the certificates in my .bat (certificatepath and certificatepasswordpath):
How can I generate or from where I generate the .pfx and .cred? I use the Create-SecureCertificatePassword.ps1, but... I have a mistake.
Thanks for your support!