Sep 14 2022 03:48 AM
Hi,
i have been running the command
Get-Mailbox |Select-Object DisplayName, PrimarySmtpAddress |Sort-Object DisplayName | Export-CSV C:\IT\Powershell\Users.csv
as part of a powershell script for a few months without issue. Now when i run it i get
Active Directory operation failed on PROD.OUTLOOK.COM. Additional information: Active directory response: The server does not support the control. The control is critical.
Have they stopped this command?
thanks
Gareth
Sep 14 2022 10:12 AM
Sep 15 2022 02:05 AM
Sep 15 2022 08:20 AM
Sep 16 2022 08:25 AM
it works if i connect to exchangeonline using a regular user account.
Oct 07 2022 02:20 AM
my code is
$pass2 = Get-Content "C:\IT\Powershell\password.txt" | ConvertTo-SecureString
Connect-ExchangeOnline -CertificateFilePath "C:\IT\Powershell\***.pfx" -CertificatePassword $pass2 -AppId "***" -Organization "***.com"
Get-Mailbox |Select-Object DisplayName, PrimarySmtpAddress |Sort-Object DisplayName | Export-CSV C:\IT\Powershell\Users.csv
where do i add the import session code?
thanks
Oct 07 2022 02:31 AM
Oct 07 2022 02:39 AM
hi,
i get a new error now
Get-ExoMailbox : Error while querying REST service. HttpStatusCode=401 ErrorMessage=Microsoft.Exchange.Admin.OData.Core.ODataServiceException:
CrossTenantAccessNotAllowed: For AppOnly flow Tenant in token e******s.onmicrosoft.com doesn't match with Tenant in request Url b*****t.com.
at Microsoft.Exchange.AdminApi.Common.AdminApiUtils.VerifyTenantInIdentityAndUrlMatchForAppOnly(HttpContextBase httpContext)
at Microsoft.Exchange.Admin.Library.BetaHttpHandler.ProcessRequest(HttpContext context)Microsoft.Exchange.Admin.OData.Core.ODataServiceException:
CrossTenantAccessNotAllowed: For AppOnly flow Tenant in token e******s.onmicrosoft.com doesn't match with Tenant in request Url b*****t.com.
at Microsoft.Exchange.AdminApi.Common.AdminApiUtils.VerifyTenantInIdentityAndUrlMatchForAppOnly(HttpContextBase httpContext)
at Microsoft.Exchange.Admin.Library.BetaHttpHandler.ProcessRequest(HttpContext context)
At C:\IT\Powershell\OfficeUsers.ps1:10 char:1
+ Get-ExoMailbox |Select-Object DisplayName, PrimarySmtpAddress |Sort-O ...
+ ~~~~~~~~~~~~~~
+ CategoryInfo : ProtocolError: (:) [Get-EXOMailbox], RestClientException
+ FullyQualifiedErrorId : An error occurred while processing this request.,Microsoft.Exchange.Management.RestApiClient.GetExoMailbox
Oct 07 2022 02:44 AM
SolutionOct 07 2022 06:04 AM
Oct 07 2022 02:44 AM
Solution