Scroll Top
Evotec Services sp. z o.o., ul. Drozdów 6, Mikołów, 43-190, Poland

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

PowerShell

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.

Related Posts

Leave a comment

You must be logged in to post a comment.