Categories: ExchangePowerShell

Get-AdPermission – The operation couldn’t be performed because object couldn’t be found

During our recent creation of Relay Receive Connector on Exchange 2013 we've encountered an error: The operation couldn't be performed because object. Since time was an essence we didn't spent much time debugging the issue and simply found a workaround as shared below. Hopefully will be useful for you.

Problem Description

If you run the following command to get permissions assigned to Receive Connector of Exchange an error is displayed

PS C:\Windows\system32> Get-ReceiveConnector -Identity "MAIL2\SMTP Relay" | Get-ADPermission | ft user
The operation couldn't be performed because object 'MAIL2\SMTP Relay' couldn't be found on 'AD3'.
    + CategoryInfo          : InvalidData: (:) [Get-ADPermission], ManagementObjectNotFoundException
    + FullyQualifiedErrorId : [Server=MAIL1,RequestId=01e7d665-22be-4f01-8519-fb65cc4056b3,TimeStamp=2016-02-25 19:26:59] [FailureC 
   ategory=Cmdlet-ManagementObjectNotFoundException] 3A1CC281,Microsoft.Exchange.Management.RecipientTasks.GetADPermission
    + PSComputerName        : mail1

Even thou Get-AdPermission shows that the object can't be found, quick verification confirms it's there.

So what's going on?

Solution

It seems the solution to get Get-AdPermission running just fine like in example below is very simple.

Get-ReceiveConnector -Identity "MAIL2\SMTP Relay" | Get-ADPermission | ft user

Turns out if you run exactly the same command in Exchange Management Shell or standard PowerShell Window it works just fine.

[PS] C:\ExchangeScripts\Manual>Get-ReceiveConnector -Identity "MAIL2\SMTP Relay" | Get-ADPermission | ft user

User
----
NT AUTHORITY\ANONYMOUS LOGON
NT AUTHORITY\ANONYMOUS LOGON
NT AUTHORITY\ANONYMOUS LOGON
NT AUTHORITY\ANONYMOUS LOGON

However the reason for this behaviour of ISE PowerShell is not known to me at this time. So if you have to work with Get-AdPermission commands you may want to run it outside of ISE. If we ever find out the reason for this behaviour we will make sure to share the news.

This post was last modified on March 20, 2016 12:24

Przemyslaw Klys

System Architect with over 14 years of experience in the IT field. Skilled, among others, in Active Directory, Microsoft Exchange and Office 365. Profoundly interested in PowerShell. Software geek.

Share
Published by
Przemyslaw Klys

Recent Posts

Upgrade Azure Active Directory Connect fails with unexpected error

Today, I made the decision to upgrade my test environment and update the version of…

2 months ago

Mastering Active Directory Hygiene: Automating Stale Computer Cleanup with CleanupMonster

Have you ever looked at your Active Directory and wondered, "Why do I still have…

3 months ago

Active Directory Replication Summary to your Email or Microsoft Teams

Active Directory replication is a critical process that ensures the consistent and up-to-date state of…

7 months ago

Syncing Global Address List (GAL) to personal contacts and between Office 365 tenants with PowerShell

Hey there! Today, I wanted to introduce you to one of the small but excellent…

12 months ago

Active Directory Health Check using Microsoft Entra Connect Health Service

Active Directory (AD) is crucial in managing identities and resources within an organization. Ensuring its…

1 year ago

Seamless HTML Report Creation: Harness the Power of Markdown with PSWriteHTML PowerShell Module

In today's digital age, the ability to create compelling and informative HTML reports and documents…

1 year ago