Sql-Server

如何在沒有提取文件夾的情況下以“安靜簡單”模式安裝 SQL Server 2017 Express?

  • February 11, 2020

我需要以盡可能少的使用者互動來安裝 SQL Server 2017 Express。我正在使用我找到 Microsoft 下載的SQLEXPR_x64_ENU.exe安裝文件。我目前使用的安裝程序是從這裡連結到的 2017 CORE 安裝程序(我不知道人們是如何找到微軟官方下載的!)

目前,我可以通過使用以下參數對 2012 年做我想做的事:

/FEATURES="SQL, Tools" /QS /IACCEPTSQLSERVERLICENSETERMS /ADDCURRENTUSERASSQLADMIN=1 /ACTION="Install" /ERRORREPORTING=0 /INSTANCENAME="MyDB"

在 2012 年,這很好用,但是我現在正嘗試在 2017 年做同樣的事情。我遇到的問題是它在與安裝相同的目錄中創建了一個名為“SQLEXPR_x64_ENU”的提取文件夾。這是不可取的。

問題:是否有辦法阻止使用此提取文件夾,使其功能與 2012 設置相同?

或者,可以接受以下解決方案之一:

  • 允許使用者選擇提取位置 - 就像預設安裝(非安靜)一樣 - 但仍確保其餘設置的 /QS 模式
  • 設置後自動刪除提取文件夾(如果它清理完它的爛攤子就不會那麼糟糕了)

為什麼不創建一個 PowerShell 腳本來開始安裝。安裝完成後:

  • 驗證成功(可能使用返回碼或解析輸出日誌)
  • 驗證提取文件夾是否存在
  • 如果沒有錯誤,請刪除提取文件夾

/MediaPath=… 似乎是用於指定提取內容的選項。

以下是來自的輸出SQLServer2017-SSEI-Expr.exe /help

SQLServer2017-SSEI-Expr.exe [/ENU] [/Help] [/IAcceptSqlServerLicenseTerms] [/Quiet] [/HideProgressBar] [/Verbose] [/ConfigurationFile=C:\Configuration.ini] [/Action=Install] [/Language=en-US] [/MediaType=Expr] [/InstallPath=c:\Program Files\Microsoft SQL Server] [/MediaPath=C:\SetupMedia]

ACTION                    Indicates the workflow when performing a unattended operation.
                         Allowed Values      : Install, Download
                         Supported Actions   : Any

CONFIGURATIONFILE         Specifies the ConfigurationFile to use.
                         Supported Actions   : Install

ENU                       Use this parameter to install the English version of SQL Server on a localized operating system.
                         Supported Actions   : Any

HELP                      Displays the usage options for unattended operations.
                         Alias               : ?
                         Supported Actions   : Any

HIDEPROGRESSBAR           Indicates a progress bar should not be displayed in an unattended install.
                         Alias               : HP
                         Supported Actions   : Any

IACCEPTSQLSERVERLICENSETERMS Required to acknowledge acceptance of the license terms.
                         Supported Actions   : Install

INSTALLPATH               Specifies the data directory for SQL Server data files.
                         Supported Actions   : Install

LANGUAGE                  Language choice for Install or Download operations.
                         Alias               : Lang
                         Allowed Values      : zh-CN, zh-TW, en-US, fr-FR, de-DE, it-IT, ja-JP, ko-KR, pt-BR, ru-RU, es-ES
                         Supported Actions   : Any

MEDIAPATH                 Location where SQL Server setup media will be downloaded and extracted to.
                         Supported Actions   : Any

MEDIATYPE                 Indicates the type of media to download when /Action=Download
                         Alias               : MT
                         Allowed Values      : Core, Advanced, LocalDB
                         Supported Actions   : Download

QUIET                     Specifies that SQL Server Installer runs in a quiet mode without any user interface. This is used for unattended operations.
                         Alias               : Q
                         Supported Actions   : Any

VERBOSE                   Logs verbose output to the console.
                         Alias               : V
                         Supported Actions   : Any

編輯:使用核心版本(請參閱有問題的連結),您可以使用以下方法提取下載:D:\TEMP\SQLEXPR_x64_ENU.exe /x 這將下載安裝文件的位置D:\TEMP\SQLEXPR_x64_ENU\

SETUP.EXE /?提供了一堆可能有用的選項:

Microsoft (R) SQL Server 2017 14.00.1000.169
Copyright (c) 2017 Microsoft.  All rights reserved.

SQL Server 2017 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 2017 data processing and privacy controls, please see the Privacy Statement.
Usage:
setup.exe /[option]={value} /[option]={value} ...

Options:
ACTION                       Specifies a Setup work flow, like INSTALL,
                             UNINSTALL, or UPGRADE. This is a required
                             parameter.
ADDCURRENTUSERASSQLADMIN     Provision current user as a Database Engine
                             system administrator for %SQL_PRODUCT_SHORT_NAME%
                             Express.
AGTDOMAINGROUP               Either domain user name or system account
AGTSVCACCOUNT                Either domain user name or system account
AGTSVCPASSWORD               Password for domain user name. Not required for
                             system account
AGTSVCSTARTUPTYPE            Startup type for the SQL Server Agent service.
                             Supported values are Manual, Automatic or
                             Disabled.
ALLINSTANCES                 Specifies that all instances are to be included
                             in the Setup operation. This parameter is
                             supported only when applying a patch.
ASBACKUPDIR                  The location for the Analysis Services backup
                             files.
ASCOLLATION                  The collation used by Analysis Services.
ASCONFIGDIR                  The location for the Analysis Services
                             configuration files.
ASDATADIR                    The location for the Analysis Services data
                             files.
ASLOGDIR                     The location for the Analysis Services log files.
ASPROVIDERMSOLAP             Specifies if the MSOLAP provider can run in
                             process.
ASSERVERMODE                 Specifies the server mode of the Analysis
                             Services instance. Valid values are
                             MULTIDIMENSIONAL and TABULAR. The default value
                             is TABULAR.
ASSVCACCOUNT                 The account used by the Analysis Services
                             service.
ASSVCPASSWORD                The password for the Analysis Services service
                             account.
ASSVCSTARTUPTYPE             Controls the service startup type setting for the
                             service.
ASSYSADMINACCOUNTS           Specifies the list of administrator accounts to
                             provision.
ASTELSVCACCT                 ASTelemetryUserNameConfigDescription
ASTELSVCPASSWORD             ASTelemetryPasswordConfigDescription
ASTELSVCSTARTUPTYPE          ASTelemetryStartupConfigDescription
ASTEMPDIR                    The location for the Analysis Services temporary
                             files.
BROWSERSVCSTARTUPTYPE        Startup type for Browser Service.
CLTCTLRNAME                  The computer name that the client communicates
                             with for the Distributed Replay Controller
                             service.
CLTRESULTDIR                 The result directory for the Distributed Replay
                             Client service.
CLTSTARTUPTYPE               The startup type for the Distributed Replay
                             Client service.
CLTSVCACCOUNT                The account used by the Distributed Replay Client
                             service.
CLTSVCPASSWORD               The password for the Distributed Replay Client
                             service account.
CLTWORKINGDIR                The working directory for the Distributed Replay
                             Client service.
CLUSTERPASSIVE               Specifies that SQL Server Setup should not manage
                             the SQL Server services. This option should be
                             used only in a non-Microsoft cluster environment.
COMMFABRICENCRYPTION         MATRIXCOMMMESSAGEPROTECTION {0,1}
COMMFABRICNETWORKLEVEL       MATRIXCOMMNETWORKISOLATION {0,1}
COMMFABRICPORT               MATRIXCOMMPORT <port>
CONFIGURATIONFILE            Specifies the configuration file to be used for
                             Setup.
CONFIRMIPDEPENDENCYCHANGE    Indicates that the change in IP address resource
                             dependency type for the SQL Server multi-subnet
                             failover cluster is accepted.
CTLRSTARTUPTYPE              The startup type for the Distributed Replay
                             Controller service.
CTLRSVCACCOUNT               The account used by the Distributed Replay
                             Controller service.
CTLRSVCPASSWORD              The password for the Distributed Replay
                             Controller service account.
CTLRUSERS                    The Windows account(s) used to grant permission
                             to the Distributed Replay Controller service.
ENABLERANU                   Set to "1" to enable RANU for SQL Server Express.
ENU                          Use the /ENU parameter to install the English
                             version of SQL Server on your localized Windows
                             operating system.
EXTSVCACCOUNT                User account for Launchpad Service.
EXTSVCPASSWORD               User password for Launchpad Service account.
FAILOVERCLUSTERDISKS         Specifies a cluster shared disk to associate with
                             the SQL Server failover cluster instance.
FAILOVERCLUSTERGROUP         Specifies the name of the cluster group for the
                             SQL Server failover cluster instance.
FAILOVERCLUSTERIPADDRESSES   Specifies an encoded IP address. The encodings
                             are semicolon-delimited (;), and follow the
                             format <IP Type>;<address>;<network name>;<subnet
                             mask>. Supported IP types include DHCP, IPV4, and
                             IPV6.
FAILOVERCLUSTERNETWORKNAME   Specifies the name of the SQ LServer failover
                             cluster instance.  This name is the network name
                             that is used to connect to SQL Server services.
FAILOVERCLUSTERROLLOWNERSHIP Specifies whether the upgraded nodes should take
                             ownership of the failover instance group or not.
                             Use 0 to retain ownership in the legacy nodes, 1
                             to make the upgraded nodes take ownership, or 2
                             to let SQL Server Setup decide when to move
                             ownership.
FEATURES                     Specifies features to install, uninstall, or
                             upgrade. The list of top-level features include
                             SQL, AS, IS, MDS, and Tools. The SQL feature will
                             install the Database Engine, Replication,
                             Full-Text, and Data Quality Services (DQS)
                             server. The Tools feature will install shared
                             components.
FILESTREAMLEVEL              Level to enable FILESTREAM feature at (0, 1, 2 or
                             3).
FILESTREAMSHARENAME          Name of Windows share to be created for
                             FILESTREAM File I/O.
FTSVCACCOUNT                 User account for Full-text Filter Daemon Host.
FTSVCPASSWORD                User password for Full-text Filter Daemon Host
                             account.
FTUPGRADEOPTION              Full-text catalog upgrade option.
HELP                         Displays the command line parameters usage
IACCEPTPYTHONLICENSETERMS    By specifying this parameter and accepting
                             Microsoft R Open and Microsoft R Server terms,
                             you acknowledge that you have read and understood
                             the terms of use.
IACCEPTROPENLICENSETERMS     By specifying this parameter and accepting
                             Microsoft R Open and Microsoft R Server terms,
                             you acknowledge that you have read and understood
                             the terms of use.
IACCEPTRSUNINSTALL           By specifying this parameter, you acknowledge
                             that Reporting Services will be uninstalled and
                             you've performed any necessary backup and/or
                             migration.
IACCEPTSQLSERVERLICENSETERMS By specifying this parameter and accepting the
                             SQL Server license terms, you acknowledge that
                             you have read and understood the terms of use.
INDICATEPROGRESS             Specifies that the detailed Setup log should be
                             piped to the console.
INSTALLSHAREDDIR             Specify the root installation directory for
                             shared components.  This directory remains
                             unchanged after shared components are already
                             installed.
INSTALLSHAREDWOWDIR          Specify the root installation directory for the
                             WOW64 shared components.  This directory remains
                             unchanged after WOW64 shared components are
                             already installed.
INSTALLSQLDATADIR            The Database Engine root data directory.
INSTANCEDIR                  Specify the instance root directory.
INSTANCEID                   Specify the Instance ID for the SQL Server
                             features you have specified. SQL Server directory
                             structure, registry structure, and service names
                             will incorporate the instance ID of the SQL
                             Server instance.
INSTANCENAME                 Specify a default or named instance. MSSQLSERVER
                             is the default instance for non-Express editions
                             and SQLExpress for Express editions. This
                             parameter is required when installing the SQL
                             Server Database Engine (SQL), or Analysis
                             Services (AS).
ISMASTERSVCACCOUNT           Either domain user name or system account.
ISMASTERSVCPASSWORD          Password for domain user.
ISMASTERSVCPORT              Network port.
ISMASTERSVCSSLCERTCN         CNs in a SSL certificate, e.g. CN=[MachineName];
                             CN=[IP]
ISMASTERSVCSTARTUPTYPE       Automatic, Manual or Disabled.
ISMASTERSVCTHUMBPRINT        Thumbprint of a SSL certificate.
ISSVCACCOUNT                 Either domain user name or system account.
ISSVCPASSWORD                Password for domain user.
ISSVCSTARTUPTYPE             Automatic, Manual or Disabled.
ISTELSVCACCT                 TelemetryUserNameConfigDescription
ISTELSVCPASSWORD             TelemetryPasswordConfigDescription
ISTELSVCSTARTUPTYPE          TelemetryStartupConfigDescription
ISWORKERSVCACCOUNT           Either domain user name or system account.
ISWORKERSVCCERT              Path of a certificate file.
ISWORKERSVCMASTER            Master machine name/ip and port,
                             https://[Name]:[Port] or https://[IP]:[Port].
ISWORKERSVCPASSWORD          Password for domain user.
ISWORKERSVCSTARTUPTYPE       Automatic, Manual or Disabled.
MATRIXCMBRICKCOMMPORT        MATRIXCMBRICKCOMMPORT portNumber
MATRIXCMSERVERNAME           MATRIXCMSERVERNAME hostName\instanceName
MATRIXNAME                   MATRIXNAME=<name>
MRCACHEDIRECTORY             Cache directory for Microsoft R Open and
                             Microsoft R Server.
NPENABLED                    Specify 0 to disable or 1 to enable the Named
                             Pipes protocol.
PBDMSSVCACCOUNT              PolybaseDmsUserNameConfigDescription
PBDMSSVCPASSWORD             PolybaseDmsPasswordConfigDescription
PBDMSSVCSTARTUPTYPE          PolybaseDmsStartupConfigDescription
PBENGSVCACCOUNT              PolybasePdwUserNameConfigDescription
PBENGSVCPASSWORD             PolybasePdwPasswordConfigDescription
PBENGSVCSTARTUPTYPE          PolybasePdwStartupConfigDescription
PBPORTRANGE                  PolybasePortRangeDescription
PBSCALEOUT                   PolybaseScaleOutDescription
PID                          Specify the SQL Server product key to configure
                             which edition you would like to use.
QUIET                        Setup will not display any user interface.
QUIETSIMPLE                  Setup will display progress only, without any
                             user interaction.
ROLE                         Detailed help for command line argument ROLE has
                             not been defined yet.
RSCATALOGSERVERINSTANCENAME  The SQL Server server for the report server
                             catalog database.
RSINSTALLMODE                Specifies which mode report server is installed
                             in.
                             Default value: "FilesOnly"
RSSVCACCOUNT                 Specify the service account of the report server.
                             This value is required. If you omit this value,
                             Setup will use the default built-in account for
                             the current operating system (either
                             NetworkService or LocalSystem). If you specify a
                             domain user account, the domain must be under 254
                             characters and the user name must be under 20
                             characters. The account name cannot contain the
                             following characters:
                             " / \ [ ] : ; | = , + * ? < >
RSSVCPASSWORD                Specify a strong password for the account. A
                             strong password is at least 8 characters and
                             includes a combination of upper and lower case
                             alphanumeric characters and at least one symbol
                             character. Avoid spelling an actual word or name
                             that might be listed in a dictionary.
RSSVCSTARTUPTYPE             Specifies the startup mode for the Report Server
                             service. Valid values include Manual, Automatic,
                             and Disabled. The default value for StartupType
                             is Manual, where the server is started when a
                             request is received.
RULES                        Specifies the list of rule IDs or rule group IDs
                             to run.
SAPWD                        Password for SQL Server sa account.
SECURITYMODE                 The default is Windows Authentication. Use "SQL"
                             for Mixed Mode Authentication.
SQLBACKUPDIR                 Default directory for the Database Engine backup
                             files.
SQLCOLLATION                 Specifies a Windows collation or an SQL collation
                             to use for the Database Engine.
SQLSVCACCOUNT                Account for SQL Server service: Domain\User or
                             system account.
SQLSVCINSTANTFILEINIT        Set to "True" to enable instant file
                             initialization for SQL Server service.
SQLSVCPASSWORD               A SQL Server service password is required only
                             for a domain account.
SQLSVCSTARTUPTYPE            Startup type for the SQL Server service.
SQLSYSADMINACCOUNTS          Windows account(s) to provision as SQL Server
                             system administrators.
SQLTELSVCACCT                TelemetryUserNameConfigDescription
SQLTELSVCPASSWORD            TelemetryPasswordConfigDescription
SQLTELSVCSTARTUPTYPE         TelemetryStartupConfigDescription
SQLTEMPDBDIR                 Directories for Database Engine TempDB files.
SQLTEMPDBFILECOUNT           The number of Database Engine TempDB files.
SQLTEMPDBFILEGROWTH          Specifies the automatic growth increment of each
                             Database Engine TempDB data file in MB.
SQLTEMPDBFILESIZE            Specifies the initial size of a Database Engine
                             TempDB data file in MB.
SQLTEMPDBLOGDIR              Directory for the Database Engine TempDB log
                             files.
SQLTEMPDBLOGFILEGROWTH       Specifies the automatic growth increment of the
                             Database Engine TempDB log file in MB.
SQLTEMPDBLOGFILESIZE         Specifies the initial size of the Database Engine
                             TempDB log file in MB.
SQLUSERDBDIR                 Default directory for the Database Engine user
                             databases.
SQLUSERDBLOGDIR              Default directory for the Database Engine user
                             database logs.
SUPPRESSPRIVACYSTATEMENTNOTI Specifies that SQL Server Setup should not
                             display the privacy statement when ran from the
                             command line.
TCPENABLED                   Specify 0 to disable or 1 to enable the TCP/IP
                             protocol.
UIMODE                       Parameter that controls the user interface
                             behavior. Valid values are Normal for the full
                             UI,AutoAdvance for a simplied UI, and
                             EnableUIOnServerCore for bypassing Server Core
                             setup GUI block.
UpdateEnabled                Specify whether SQL Server Setup should discover
                             and include product updates. The valid values are
                             True and False or 1 and 0. By default SQL Server
                             Setup will include updates that are found.
UpdateSource                 Specify the location where SQL Server Setup will
                             obtain product updates. The valid values are "MU"
                             to search Microsoft Update, a valid folder path,
                             a relative path such as .\MyUpdates or a UNC
                             share. By default SQL Server Setup will search
                             Microsoft Update or a Windows Update service
                             through the Window Server Update Services.
USEMICROSOFTUPDATE           If this parameter is provided, then this computer
                             will use Microsoft Update to check for updates.
X86                          Specifies that Setup should install into WOW64.
                             This command line argument is not supported on an
                             IA64 or a 32-bit system.

Full unattended installation example, showing all required parameters:


setup.exe /Q /IACCEPTSQLSERVERLICENSETERMS /ACTION=install /PID=<validpid> /FEATURES=SQL,AS,IS,Tools
/INSTANCENAME=MSSQLSERVER /SQLSVCACCOUNT="MyDomain\MyAccount"
/SQLSVCPASSWORD="************" /SQLSYSADMINACCOUNTS="MyDomain\MyAccount "
/AGTSVCACCOUNT="MyDomain\MyAccount" /AGTSVCPASSWORD="************"
/ASSVCACCOUNT="MyDomain\MyAccount" /ASSVCPASSWORD="************"
/ISSVCAccount="MyDomain\MyAccount" /ISSVCPASSWORD="************"
/ASSYSADMINACCOUNTS="MyDomain\MyAccount"

Press any key to exit...

引用自:https://dba.stackexchange.com/questions/259396