ADSync Cmdlets Fail with Remote PowerShell
The ADSync cmdlets do not work with remote PowerShell. A command such as Get-ADSyncRunProfileResult works fine when executed on the computer with an interactive logon but fails when run using WinRM with Invoke-Command or Enter-PSSession.
When called with Remote PowerShell the cmdlets fail when establishing a connection to net.pipe://localhost/ADSyncManagement.
Since WMI was taken away, we really need a way to access the ADSync module without having to logon interactively.
Here is the error:
Invoke-Command -ComputerName myAADConnectServer -ScriptBlock {Get-ADSyncRunProfileResult}
There was no endpoint listening at net.pipe://localhost/ADSyncManagement that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
+ CategoryInfo : ReadError: (Microsoft.Ident...ileResultCmdlet:GetADSyncRunProfileResultCmdlet) [Get-ADSyncRunProfileResult], EndpointNotFoundException
+ FullyQualifiedErrorId : Microsoft.IdentityManagement.PowerShell.Cmdlet.GetADSyncRunProfileResultCmdlet
+ PSComputerName : myAADConnectServer

3 comments
-
Mike Campbell commented
Yes, this is not a good situation for customers that would like to automate management of their AD Sync configuration and reporting. This is a serious obstacle in the way of managing the overall Office 365 configuration as code.
-
Trond Skille commented
Had the same issue.
We use remoting to automate the creation of new connectors and rules.
Solved it by using the module Invoke-CommandAs by 'mkellerman'
https://github.com/mkellerman/Invoke-CommandAsInvoke-CommandAs -ComputerName $server -AsSystem -ScriptBlock {
Get-ADSyncRunProfileResult
} -
DanPan commented
We have the same issue.
We use AADC remote powershell adsync cmdlets to compare the connectors/rules on active & staging AADC servers.
Please fix it !