AD Connect Sync rules export to csv file

Joseph Patrick 641 Reputation points

I have a lot of AD Sync rules stated in the sync editor, is there a script or PowerShell way to export the rules and list them in a excel (.csv file)?

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,277 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
18,683 questions
0 comments No comments
{count} vote

Accepted answer
  1. Joseph Patrick 641 Reputation points

    I solved the problem by writing the following script:

    $ADSyncRules = Get-ADSyncRule
    $connectors = Get-ADSyncConnector
    $ConfigBasePath = "C:\temp"
    $ADSyncRules|select Identifier,Name, @{n="Connector";e={($connectors|Where Identifier -eq $_.Connector).Name}},Description,Disabled,IsStandardRule,Precedence, SourceObjectType,TargetObjectType,LinkType,Direction | Export-Csv ("$ConfigBasePath\{0}.csv" -f $env:COMPUTERNAME) -NoTypeInformation -Force
    1 person found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Vasil Michev 91,046 Reputation points MVP
    0 comments No comments

  2. Joseph Patrick 641 Reputation points

    I did that but it exports the rules in its own xml document, I am looking for a way that would get the rules and export the information of the following headers into a csv file:

    Name Connector Precedence Connector Object Type Metaverse Object Type Direction

    I was looking at the get-adsyncrule or the export-adsyncrule but not enough information is published to know it it will accomplish the task.

    0 comments No comments