|
| 1 | +<# |
| 2 | + .SYNOPSIS |
| 3 | + Returns the integration services settings. |
| 4 | +
|
| 5 | + .DESCRIPTION |
| 6 | + Returns the integration services settings. |
| 7 | +
|
| 8 | + .PARAMETER Version |
| 9 | + Specifies the version for which to return settings for. |
| 10 | +
|
| 11 | + .OUTPUTS |
| 12 | + `[System.Management.Automation.PSCustomObject]` |
| 13 | +
|
| 14 | + .EXAMPLE |
| 15 | + Get-SqlDscIntegrationServicesSetting -Version ([System.Version] '16.0') |
| 16 | +
|
| 17 | + Returns the settings for the integration services. |
| 18 | +#> |
| 19 | +function Get-SqlDscDatabaseEngineSetting |
| 20 | +{ |
| 21 | + [CmdletBinding()] |
| 22 | + [OutputType([System.Boolean])] |
| 23 | + param |
| 24 | + ( |
| 25 | + [Parameter(Mandatory = $true)] |
| 26 | + [System.Version] |
| 27 | + $Version |
| 28 | + ) |
| 29 | + |
| 30 | + <# |
| 31 | + HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL13.SQL2016\Setup |
| 32 | +
|
| 33 | + FeatureList |
| 34 | + Version |
| 35 | + PatchLevel |
| 36 | + Edition |
| 37 | + EditionType |
| 38 | + Language |
| 39 | + ProductCode |
| 40 | + SqlPath |
| 41 | +
|
| 42 | + TODO: Gör en Get-SqlDscServiceName med data från HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Services |
| 43 | + Liknande Get-SqlDscInstalledInstance |
| 44 | + #> |
| 45 | + $masterDataServicesSettings = $null |
| 46 | + |
| 47 | + $getItemPropertyParameters = @{ |
| 48 | + Path = 'HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\{0}0\Master Data Services\Setup\MDSCoreFeature' -f $Version.Major |
| 49 | + ErrorAction = 'SilentlyContinue' |
| 50 | + } |
| 51 | + |
| 52 | + $mdsCoreFeatureSettings = Get-ItemProperty @getItemPropertyParameters |
| 53 | + |
| 54 | + if (-not $mdsCoreFeatureSettings) |
| 55 | + { |
| 56 | + $missingIntegrationServiceMessage = $script:localizedData.MasterDataServicesSetting_Get_NotInstalled -f $Version.ToString() |
| 57 | + |
| 58 | + $writeErrorParameters = @{ |
| 59 | + Message = $missingIntegrationServiceMessage |
| 60 | + Category = 'InvalidOperation' |
| 61 | + ErrorId = 'GISS0001' # cspell: disable-line |
| 62 | + TargetObject = $Version |
| 63 | + } |
| 64 | + |
| 65 | + Write-Error @writeErrorParameters |
| 66 | + } |
| 67 | + else |
| 68 | + { |
| 69 | + $masterDataServicesSettings1 = [InstalledComponentSetting]::Parse($mdsCoreFeatureSettings) |
| 70 | + |
| 71 | + $getItemPropertyParameters = @{ |
| 72 | + Path = 'HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\{0}0\Master Data Services\Setup' -f $Version.Major |
| 73 | + ErrorAction = 'SilentlyContinue' |
| 74 | + } |
| 75 | + |
| 76 | + $mdsSetupSettings = Get-ItemProperty @getItemPropertyParameters |
| 77 | + |
| 78 | + $masterDataServicesSettings2 = [InstalledComponentSetting]::Parse($mdsSetupSettings) |
| 79 | + |
| 80 | + $masterDataServicesSettings = $masterDataServicesSettings1 + $masterDataServicesSettings2 |
| 81 | + } |
| 82 | + |
| 83 | + return $masterDataServicesSettings |
| 84 | +} |
0 commit comments