适用于:SQL Server
Azure SQL 数据库
Azure SQL 托管实例
Azure Synapse Analytics
有许多命令行参数可用于安装 SQL Server Management Studio(SSMS)。 包括几个示例,可以自定义以满足你的需求。
所有命令都需要进行管理提升,如果没有通过提升的提示符启动进程,将显示用户帐户控制提示。
可以使用命令行末尾的 ^ 字符将多行连接成单个命令。 或者,可以将这些行放在同一行中。 在 PowerShell 中,等效字符为反引号 (`)。
若要以非交互方式执行命令,可以使用 --passive 或 --quiet。 有关这些参数的详细信息,请参阅 使用命令行参数安装 SQL Server Management Studio。
有关可以使用命令行安装的工作负荷和组件的列表,请参阅 SQL Server Management Studio 的工作负荷和组件 ID。
使用 --installPath 和 --add 与引导程序一起安装
安装 SSMS 的最小实例,没有交互式提示,但显示进度:
vs_SSMS.exe --installPath C:\SSMS21 --passive --norestart
使用意大利语语言包静默安装 SSMS,仅在产品安装完成后返回。
vs_SSMS.exe --installPath C:\SSMS21 --addProductLang it-it --quiet --wait
安装工作负载
使用 Git 集成安装 SSMS,用户界面以非交互方式显示:
vs_SSMS.exe --add Microsoft.SqlServer.Workload.SSMS.CodeTools --includeRecommended --passive
使用商业智能工作负载中的所有组件安装 SSMS,用户界面以非交互方式显示:
vs_SSMS.exe --add Microsoft.SqlServer.Workload.SSMS.BI --includeRecommended --passive --norestart
更新
通过命令行更新 SSMS 安装,其中显示了进度,并且没有交互式提示。 不能以编程方式从安装程序所在的同一文件夹中启动安装程序。
vs_SSMS.exe update --passive --norestart --installPath "C:\SSMS21"
通过命令行悄然更新 SSMS 安装:
vs_SSMS.exe update --noWeb --quiet --wait --norestart
用于 --layout 创建网络布局或本地缓存
创建一个布局,其中包含 SSMS 和 SSMS 中的 Copilot 以及英语语言包:
vs_SSMS.exe --layout C:\SSMS_Layout --lang en-US --add Microsoft.SqlServer.Workload.SSMS.AI --includeRecommended
创建一个布局,其中包含 SSMS 和位于 SSMS 中的 Integration Services,以及英语语言包。
vs_SSMS.exe --layout C:\SSMS_Layout --lang en-US --add Microsoft.SSMS.Component.IS --includeRecommended
使用三种语言创建包含两个工作负载和一个可选组件的布局:
vs_SSMS.exe --layout C:\SSMS_Layout --lang en-US --add Microsoft.SqlServer.Workload.SSMS.HybridAndMigration --add Microsoft.SqlServer.Workload.SSMS.CodeTools --add Microsoft.Component.HelpViewer --lang en-US de-DE ja-JP
若要为 SQL Server Management Studio 和所有语言创建完整的本地布局,请运行:
vs_SSMS.exe --layout C:\SSMS_Layout --all
若要为 SQL Server Management Studio 创建本地布局,该布局将组件限制为仅 Integration Services 和 Reporting Services 组件,请运行:
vs_SSMS.exe --layout C:\SSMS_Layout --add Microsoft.SSMS.Component.IS --add Microsoft.SSMS.Component.RS
若要为 SQL Server Management Studio 创建本地布局,该布局将组件限制为仅脱机帮助内容,请运行:
vs_SSMS.exe --layout C:\SSMS_Layout --add Microsoft.Component.HelpViewer
安装布局
创建布局后,可以将其复制到脱机计算机进行安装。 若要安装特定组件,这些组件必须已包含在脱机布局中。 有关详细信息,请参阅 完整的本地布局 示例。
请确保你在保存布局的文件夹中。 在这些示例中,它是 C:\SSMS_Layout。
C:\SSMS_Layout\vs_SSMS.exe --lang en-US --add Microsoft.SqlServer.Workload.SSMS.AI --includeRecommended
若要从布局安装具有 Integration Services 支持的 SSMS,请运行:
C:\SSMS_Layout\vs_SSMS.exe --noWeb --noUpdateInstaller --add Microsoft.SSMS.Component.IS --includeRecommended --passive
若要安装具有 Integration Services 和 Reporting Services 支持的 SSMS,请运行:
C:\SSMS_Layout\vs_SSMS.exe --noWeb --noUpdateInstaller --add Microsoft.SSMS.Component.IS --add Microsoft.SSMS.Component.RS --includeRecommended --passive
使用布局更新现有安装
若要将 SSMS 更新到最新版本,请创建与原始安装相同的组件的布局。
切换到布局文件夹:
cd C:\SSMS_Layout更新到最新版本:
vs_SSMS.exe update --noWeb
使用布局修改现有安装
若要更新 SSMS 以包含其他组件,请使用前面的示例创建具有所需组件的布局。
更改至布局文件夹:
cd C:\SSMS_Layout更新到最新版本:
vs_SSMS.exe update --noWeb --quiet --wait --norestart修改 SSMS,以添加 Analysis Services、Integration Services 和 Reporting Services 组件,请使用包含这些组件的脱机布局,然后运行命令:
vs_SSMS.exe modify --noWeb --productID Microsoft.VisualStudio.Product.SSMS --channelID SSMS.21.SSMS.Release --add Microsoft.SSMS.Component.AS --add Microsoft.SSMS.Component.IS --add Microsoft.SSMS.Component.RS --quiet --norestart
卸载现有安装
若要从工作站卸载 SSMS 21 GA 版本,请使用以下示例。
更改为 Visual Studio Installer 文件夹:
cd "C:\Program Files (x86)\Microsoft Visual Studio\Installer"删除 SSMS 21 GA(发布)版本:
setup.exe uninstall --passive --productId Microsoft.VisualStudio.Product.Ssms --channelId SSMS.21.SSMS.Release --noweb