AD Sync — service and miiserver enum

Ctrl+F: ADSync · Get-Item · Get-ItemProperty · miiserver.exe · Azure AD Connect

Azure AD Connect Sync (service name ADSync) runs on a Windows server and syncs on-prem AD to Azure AD. On a compromised sync server, these commands confirm the service exists, where binaries live, and version/path details for further abuse (credential stores, config files, DCSync-related paths).

Hub → PowerShell Snippets · cmdlet reference → PowerShell Cmdlets > 📌 7) Registry


Command 1 — ADSync service registry key

Get-Item -Path HKLM:\SYSTEM\CurrentControlSet\Services\ADSync

What it does

Get-Item returns the registry key object for the ADSync Windows service — same tree as regeditHKLM\SYSTEM\CurrentControlSet\Services\ADSync.

You see the key container; use Get-ItemProperty on the same path for values (ImagePath, Start, ObjectName, etc.).

Read service values (companion command)

Get-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\ADSync
Get-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\ADSync |
  Format-List -Property * -Force
Value (typical)Meaning
ImagePathBinary that starts the service
Start2 = Automatic, 3 = Manual
ObjectNameService account (often NT SERVICE\ADSync or domain account)
DisplayNameAzure AD Connect Sync

Alternative — Get-Service

Get-Service -Name ADSync
Get-CimInstance Win32_Service -Filter "Name='ADSync'" |
  Select Name, State, StartName, PathName

Command 2 — miiserver.exe file properties

Get-ItemProperty -Path "C:\Program Files\Microsoft Azure AD Sync\Bin\miiserver.exe" |
  Format-List -Property * -Force

What it does

Get-ItemProperty on a file path returns the PowerShell file item property bag — size, dates, attributes, and VersionInfo (product version, company, original filename).

Format-List -Property * -Force prints every property (including hidden/default) — useful when hunting version strings, signing info, or paths referenced in metadata.

Why miiserver.exe?

miiserver.exe is the core Microsoft Identity Integration Server engine for Azure AD Connect Sync. Confirming it exists proves the full sync stack is installed (not just the ADSync service entry).

Test-Path "C:\Program Files\Microsoft Azure AD Sync\"
Get-ChildItem "C:\Program Files\Microsoft Azure AD Sync\" -Recurse -ErrorAction SilentlyContinue |
  Select FullName
 
# Config / cred-related (enum only — do not exfil outside lab rules)
Get-ChildItem "C:\Program Files\Microsoft Azure AD Sync\Data\" -ErrorAction SilentlyContinue

When to use (OSCP / AD)

ScenarioAction
Box mentions Azure AD Connect, Entra, hybrid ADRun both commands
You have shell on server that syncs to cloudConfirm ADSync + binary version
Privesc / lateral — high-value server roleNote service account from ObjectName / StartName
BloodHound / AD path to sync serverValidate before hunting sync credentials

Active Directory · AD · PowerView


Full copy-paste block

# Service registry key
Get-Item -Path HKLM:\SYSTEM\CurrentControlSet\Services\ADSync
Get-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\ADSync |
  Format-List -Property * -Force
 
# Sync engine binary
Get-ItemProperty -Path "C:\Program Files\Microsoft Azure AD Sync\Bin\miiserver.exe" |
  Format-List -Property * -Force
 
# Quick service status
Get-Service ADSync -ErrorAction SilentlyContinue

External docs

Full cmdlet wiki → PowerShell Snippets > 📌 External references (detailed Windows / PowerShell wikis)