You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过命令行批量更新多台Windows Server 2019上的Visual Studio Code

远程更新Windows Server 2019上的Visual Studio Code(无winget)

方法1:利用VS Code内置安装程序的更新参数

VS Code官方安装程序支持命令行静默更新,无需额外工具:

  • 若为系统级安装(默认路径C:\Program Files\Microsoft VS Code\),执行以下PowerShell命令:
Start-Process "C:\Program Files\Microsoft VS Code\CodeSetup.exe" -ArgumentList "/verysilent /update" -Wait
  • 若为用户级安装(路径C:\Users\<目标用户名>\AppData\Local\Programs\Microsoft VS Code\),替换路径后执行:
Start-Process "C:\Users\<目标用户名>\AppData\Local\Programs\Microsoft VS Code\CodeSetup.exe" -ArgumentList "/verysilent /update" -Wait

参数说明:

  • /verysilent:完全静默执行,无任何界面弹窗
  • /update:触发安装程序执行更新逻辑
  • -Wait:等待更新完成后再继续后续操作

方法2:手动下载最新安装包并静默部署

如果内置更新失效,可手动获取最新安装包后远程静默安装:

  1. 提前下载最新版VS Code安装包(CodeSetup.exe),上传至服务器共享目录或本地临时路径
  2. 在目标服务器执行以下命令:
Start-Process "C:\temp\CodeSetup.exe" -ArgumentList "/verysilent /norestart" -Wait

参数说明:

  • /norestart:禁止更新后自动重启服务器,适配生产环境需求

批量远程更新多台服务器

通过PowerShell的Invoke-Command可批量操作多台服务器:

# 定义目标服务器列表
$serverList = @("Server01", "Server02", "Server03")
# 执行批量更新
Invoke-Command -ComputerName $serverList -ScriptBlock {
    # 根据实际安装路径选择命令,这里以系统级安装为例
    Start-Process "C:\Program Files\Microsoft VS Code\CodeSetup.exe" -ArgumentList "/verysilent /update" -Wait
} -Credential (Get-Credential)

注意:执行时需提供具有目标服务器管理员权限的凭据。

内容的提问来源于stack exchange,提问作者Sophie

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.21 18:03:15