Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install-SqlDscServer with -PrepareImage errors when InstanceName is specified #1960

Closed
derhally opened this issue Aug 17, 2023 · 1 comment · Fixed by #1961
Closed

Install-SqlDscServer with -PrepareImage errors when InstanceName is specified #1960

derhally opened this issue Aug 17, 2023 · 1 comment · Fixed by #1961
Labels
bug The issue is a bug. good first issue The issue should be easier to fix and can be taken up by a beginner to learn to contribute on GitHub

Comments

@derhally
Copy link

Problem description

We are trying to syspref a VM image that include sql server. I'm using the Install-SqlDscServer with the -PrepareImage option like

Install-SqlDscServer -PrepareImage -AcceptLicensingTerms -InstanceName 'MSSQLSERVER' -InstanceId 'MSSQLSERVER' -Features 'SQLENGINE' -MediaPath "D:\" -Force -Verbose

It errors with

Microsoft (R) SQL Server 2022 16.00.1000.06
Copyright (c) 2022 Microsoft.  All rights reserved.

SQL Server 2022 transmits information about your installation experience, as well as other usage and performance data, to Microsoft to help improve the product. To learn more about SQL Server 2022 data processing and privacy controls, please see the Privacy Statement.
The following error occurred:
The setting 'INSTANCENAME' is not allowed when the value of setting 'ACTION' is 'PrepareImage'.

Error result: -2068578299
Result facility code: 1204
Result error code: 5

If i remove the instanceName switch, it prompts me for InstanceName

cmdlet Install-SqlDscServer at command pipeline position 1
Supply values for the following parameters:
InstanceName:

Verbose logs

Provided all the logging I have in the description

How to reproduce

Run the command (update the media path)

Install-SqlDscServer -PrepareImage -AcceptLicensingTerms -InstanceName 'MSSQLSERVER' -InstanceId 'MSSQLSERVER' -Features 'SQLENGINE' -MediaPath "D:\" -Force -Verbose

Expected behavior

Only pass InstanceName when needed

Current behavior

The cmdlet errors out.

Suggested solution

not sure yet

Operating system the target node is running

OsName               : Microsoft Windows Server 2022 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture       : 64-bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 20348.1.amd64fre.fe_release.210507-1500
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

PowerShell version and build the target node is running

Name                           Value
----                           -----
PSVersion                      7.2.11
PSEdition                      Core
GitCommitId                    7.2.11
OS                             Microsoft Windows 10.0.20348
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module version used

16.3.1
@johlju
Copy link
Member

johlju commented Aug 18, 2023

That seems to be a bug, InstanceName is not mentioned in the docs either: https://learn.microsoft.com/en-us/sql/database-engine/install-windows/install-sql-server-from-the-command-prompt?view=sql-server-ver16#prepare-image-parameters

It seems then that these lines should be removed:

[Parameter(ParameterSetName = 'PrepareImage', Mandatory = $true)]

[Parameter(ParameterSetName = 'PrepareImage', Mandatory = $true)]

Can you confirm that it works if you remove the line from each function?

@johlju johlju added bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community. good first issue The issue should be easier to fix and can be taken up by a beginner to learn to contribute on GitHub labels Aug 18, 2023
johlju added a commit that referenced this issue Aug 20, 2023
- `Install-SqlDscServer`
  - Now the parameter `InstanceName` can no longer be specified (as per
    the SQL Server documentation) for the setup action `PrepareImage`
    (issue #1960).
@johlju johlju removed the help wanted The issue is up for grabs for anyone in the community. label Aug 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug. good first issue The issue should be easier to fix and can be taken up by a beginner to learn to contribute on GitHub
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants