Gerenios / AADInternals

AADInternals PowerShell module for administering Azure AD and Office 365
http://aadinternals.com/aadinternals
MIT License
1.3k stars 217 forks source link

Add Support for SQL(Express) for Get-AADIntSyncCredentials #71

Closed zjorz closed 1 year ago

zjorz commented 1 year ago

FILE: C:\Program Files\WindowsPowerShell\Modules\AADInternals\0.9.1\AADSyncSettings.ps1

Added the bold part (Integrated Security=true;) and it worked like a charm! 😊

function Get-AADConfigDbConnection { [cmdletbinding()] Param() Begin {

Create the connection string for the configuration database

    $parametersPath =    "HKLM:\SYSTEM\CurrentControlSet\Services\ADSync\Parameters"
    $dBServer =          (Get-ItemProperty -Path $parametersPath).Server
    $dBName =            (Get-ItemProperty -Path $parametersPath).DBName
    $dBInstance =        (Get-ItemProperty -Path $parametersPath).SQLInstance
    $connectionString  = "Data Source=$dbServer\$dBInstance;**Integrated Security=true;**Initial Catalog=$dBName"
}
Process
{
    Write-Verbose "ConnectionString=$connectionString"

    return $connectionString
}

} Now BOTH Get-AADIntSyncCredentials and Get-AADIntSyncCredentials -AsBackgroundProcess $false -Verbose work

NestoriSyynimaa commented 1 year ago

Added to v0.9.2. If server is not "(localdb)", "Integrated Security=true;" is appended to connection string. Please test to see does it work.