Execution Flow
Existing environment variables are never overwritten — only missing
MSSQL{n}_Log entries are added. Mode=Test is read-only and never writes anything. Remote execution requires WinRM on target servers; AD OU mode requires the ActiveDirectory module (auto-installed via Install-sqmAdModule).Parameters
| Parameter | Type | Required | ParameterSet | Description |
|---|---|---|---|---|
| -Mode | String | Optional | All | Set (default) — write env vars + manage service. Test — read-only check. |
| -Remote | Switch | Optional | Remote | Execute via WinRM on servers discovered from Active Directory OU. |
| -SearchOU | String | Optional | Remote | AD OU distinguished name or simple name. Default: OUServDatabase. |
| -ComputerList | String[] | Optional | List | Explicit server names or path to a text file (lines starting with # are comments). |
| -Credential | PSCredential | Optional | Remote / List | Credentials for AD queries and WinRM remoting. |
| -LogPath | String | Optional | All | Log directory. Defaults to Get-sqmConfig 'LogPath' or %ProgramData%\sqmSQLTool\Logs. |
| -LogCallback | ScriptBlock | Optional | All | GUI logging callback. If omitted, writes to Write-Host. |
Return Value
Local mode: PSCustomObject with ComputerName, Mode, Status, Message, IsConfigured, ServiceStatus. Remote/List modes: PSCustomObject[] with Computer, Status, Fehler per server.
Examples
Example 1 — Local Set (default)
Invoke-sqmSplunkConfiguration
Example 2 — Test mode (read-only)
Invoke-sqmSplunkConfiguration -Mode Test
Example 3 — Remote AD OU
Invoke-sqmSplunkConfiguration -Remote -SearchOU "OU=DB-Server,DC=contoso,DC=com"
Example 4 — Explicit server list
Invoke-sqmSplunkConfiguration -ComputerList "SRV-SQL01","SRV-SQL02"
Example 5 — From text file, test mode
Invoke-sqmSplunkConfiguration -ComputerList "C:\Lists\db-server.txt" -Mode Test