安装和管理扩展Install and Manage Extensions

适用于:Windows Admin Center、Windows Admin Center 预览版Applies To: Windows Admin Center, Windows Admin Center Preview

Windows Admin Center 是作为可扩展的平台构建的,其中的每个连接类型和工具都是可以单独安装、卸载和更新的扩展。Windows Admin Center is built as an extensible platform where each connection type and tool is an extension that you can install, uninstall and update individually. 可以搜索由 Microsoft 和其他开发者发布的新扩展,单独安装和更新它们,不需更新整个 Windows Admin Center 安装。You can search for new extensions published by Microsoft and other developers, and install and update them individually without having to update the entire Windows Admin Center installation. 也可配置单独的 NuGet 源或文件共享,然后分发在组织内部使用的扩展。You can also configure a separate NuGet feed or file share and distribute extensions to use internally within your organization.

安装扩展Installing an extension

Windows Admin Center 会显示指定的 NuGet 源提供的扩展。Windows Admin Center will show extensions available from the specified NuGet feed. 默认情况下,Windows Admin Center 指向 Microsoft 官方 NuGet 源,其中托管由 Microsoft 和其他开发者发布的扩展。By default, Windows Admin Center points to the Microsoft official NuGet feed which hosts extensions published by Microsoft and other developers.

  1. 单击右上角的“设置”按钮,然后在左窗格中单击“扩展”。Click the Settings button in the top-right > In the left pane, click Extensions.
  2. “可用扩展”选项卡会列出源上可供安装的扩展。The Available Extensions tab will list the extensions on the feed that are available for installation.
  3. 单击某个扩展,在“详细信息”窗格中查看扩展说明、版本、发布者和其他信息。Click on an extension to view the extension description, version, publisher and other information in the Details pane.
  4. 单击“安装”,安装某个扩展。Click Install to install an extension. 如果网关必须在提升模式下运行才能进行此更改,则会显示 UAC 提升提示。If the gateway must run in elevated mode to make this change, you will be presented with a UAC elevation prompt. 安装完成后,系统会自动刷新浏览器,并会使用已安装的新扩展重新加载 Windows Admin Center。After installation is complete, your browser will automatically be refreshed and Windows Admin Center will be reloaded with the new extension installed. 如果你尝试安装的扩展是对以前安装的扩展的更新,则可单击“更新到最新”按钮来安装该更新。If the extension you are trying to install is an update to a previously installed extension, you can click the Update to latest button to install the update. 也可转到“已安装的扩展”选项卡来查看已安装的扩展,以及查看某个更新在“状态”列中是否可用。 You can also go to the Installed Extensions tab to view installed extensions and see if an update is available in the Status column.

从另一源安装扩展Installing extensions from a different feed

Windows Admin Center 支持多个源,你可以一次从多个源查看和管理包。Windows Admin Center supports multiple feeds and you can view and manage packages from more than one feed at a time. 可以将任何支持 NuGet V2 API 或文件共享的 NuGet 源添加到 Windows Admin Center,方便从其安装扩展。Any NuGet feed that supports the NuGet V2 APIs or a file share can be added to Windows Admin Center for installing extensions from.

  1. 单击右上角的“设置”按钮,然后在左窗格中单击“扩展”。Click the Settings button in the top-right > In the left pane, click Extensions.
  2. 在右窗格中,单击“源”选项卡。On the right pane, click the Feeds tab.
  3. 单击“添加”按钮以添加另一源。Click the Add button to add another feed. 对于 NuGet 源,请输入 NuGet V2 源 URL。For a NuGet feed, enter the NuGet V2 feed URL. NuGet 源提供者或管理员应该能够提供 URL 信息。The NuGet feed provider or administrator should be able to provide the URL information. 对于文件共享,请输入在其中存储扩展包文件 (.nupkg) 的文件共享的完整路径。For a file share, enter the full path of the file share in which the extension package files (.nupkg) are stored.
  4. 单击 “添加”Click Add. 如果网关必须在提升模式下运行才能进行此更改,则会显示 UAC 提升提示。If the gateway must run in elevated mode to make this change, you will be presented with a UAC elevation prompt. 仅当在桌面模式下运行 Windows Admin Center 时才会显示此提示。This prompt will only be presented if you are running Windows Admin Center in desktop mode.

“可用扩展”列表会显示所有已注册源提供的扩展。The Available Extensions list will show extensions from all registered feeds. 可以使用“包源”列来查看每个扩展来自哪个源。You can check which feed each extension is from using the Package Feed column.

卸载扩展Uninstalling an extension

可以卸载以前安装的任何扩展,甚至可以卸载在安装 Windows Admin Center 过程中预安装的任何工具。You can uninstall any extensions you have previously installed, or even uninstall any tools that were pre-installed as part of the Windows Admin Center installation.

  1. 单击右上角的“设置”按钮,然后在左窗格中单击“扩展”。Click the Settings button in the top-right > In the left pane, click Extensions.
  2. 单击“已安装的扩展”选项卡,查看所有已安装的扩展。Click the Installed Extensions tab to view all installed extensions.
  3. 选择要卸载的扩展,然后单击“卸载”。Choose an extension to uninstall, then click Uninstall.

卸载完成后,系统会自动刷新浏览器,并会重新加载 Windows Admin Center,删除该扩展。After uninstall is complete, your browser will automatically be refreshed and Windows Admin Center will be reloaded with the extension removed. 如果卸载了作为 Windows Admin Center 一部分预安装的工具,该工具会出现在“可用扩展”选项卡中,可供重新安装。If you uninstalled a tool that was pre-installed as part of Windows Admin Center, the tool will be available for reinstallation in the Available Extensions tab.

在未连接 Internet 的情况下在计算机上安装扩展Installing extensions on a computer without internet connectivity

如果 Windows Admin Center 安装在未连接到 Internet 的计算机上或位于代理后面的计算机上,则可能无法访问和安装 Windows Admin Center 源中的扩展。If Windows Admin Center is installed on a computer that isn't connected to the internet or is behind a proxy, it may not be able to access and install the extensions from the Windows Admin Center feed. 可以通过手动方式或 PowerShell 脚本方式下载扩展包,并将 Windows Admin Center 配置为从文件共享或本地驱动器检索包。You can download extension packages manually or with a PowerShell script, and configure Windows Admin Center to retrieve packages from a file share or local drive.

手动下载扩展包Manually downloading extension packages

  1. 在另一台具有 Internet 连接的计算机上,打开 Web 浏览器并导航到以下 URL:https://dev.azure.com/WindowsAdminCenter/Windows%20Admin%20Center%20Feed/_packaging?_a=feed&feed=WACOn another computer that has internet connectivity, open a web browser and navigate to the following URL: https://dev.azure.com/WindowsAdminCenter/Windows%20Admin%20Center%20Feed/_packaging?_a=feed&feed=WAC

    • 若要查看扩展包,可能需要创建一个 Microsoft 帐户并登录。You may need to create a Microsoft account and login to view the extension packages.
  2. 单击要安装的包的名称,查看包详细信息页。Click on the name of the package you want to install to view the package details page.

  3. 单击包详细信息页顶部导航栏中的“下载”链接,下载该扩展的 .nupkg 文件。Click on the Download link in the top navigation bar of the package details page and download the .nupkg file for the extension.

  4. 对所有需要下载的包重复步骤 2 和 3。Repeat steps 2 and 3 for all the packages you want to download.

  5. 将包文件复制到可以从安装了 Windows Admin Center 的计算机访问的某个文件共享,或者复制到计算机的本地磁盘。Copy the package files to a file share that can be accessed from the computer Windows Admin Center is installed on, or to the local disk of the computer.

  6. 按说明从另一源安装扩展Follow the instructions to install extensions from a different feed.

通过 PowerShell 脚本下载包Downloading packages with a PowerShell script

可以使用 Internet 上提供的许多脚本从 NuGet 源下载 NuGet 包。There are many scripts available on the Internet for downloading NuGet packages from a NuGet feed. 我们将使用 Microsoft 高级项目经理 Jon Galloway 提供的脚本We'll use the script provided by Jon Galloway, Senior Program Manager at Microsoft.

  1. 博客文章中所述,将脚本作为 NuGet 包安装,或者将脚本复制并粘贴到 PowerShell ISE 中。As described in the blog post, install the script as a NuGet package, or copy and paste the script into the PowerShell ISE.
  2. 将脚本的第一行编辑成你的 NuGet 源的 v2 URL。Edit the first line of the script to your NuGet feed's v2 URL. 如果从 Windows Admin Center 官方源下载包,请使用下面的 URL。If you are downloading packages from the Windows Admin Center official feed, use the URL below.
$feedUrlBase = "https://aka.ms/sme-extension-feed"
  1. 运行脚本,脚本会将源中的所有 NuGet 包下载到以下本地文件夹:%USERPROFILE%\Documents\NuGetLocalRun the script and it will download all the NuGet packages from the feed to the following local folder: %USERPROFILE%\Documents\NuGetLocal
  2. 按说明从另一源安装扩展Follow the instructions to install extensions from a different feed.

使用 PowerShell 管理扩展Manage extensions with PowerShell

Windows Admin Center 预览版包含一个用于管理网关扩展的 PowerShell 模块。Windows Admin Center Preview includes a PowerShell module to manage your gateway extensions.

# Add the module to the current session
Import-Module "$env:ProgramFiles\windows admin center\PowerShell\Modules\ExtensionTools"
# Available cmdlets: Get-Feed, Add-Feed, Remove-Feed, Get-Extension, Install-Extension, Uninstall-Extension, Update-Extension

# List feeds
Get-Feed "https://wac.contoso.com"

# Add a new extension feed
Add-Feed -GatewayEndpoint "https://wac.contoso.com" -Feed "\\WAC\our-private-extensions"

# Remove an extension feed
Remove-Feed -GatewayEndpoint "https://wac.contoso.com" -Feed "\\WAC\our-private-extensions"

# List all extensions
Get-Extension "https://wac.contoso.com"

# Install an extension (locate the latest version from all feeds and install it)
Install-Extension -GatewayEndpoint "https://wac.contoso.com" "msft.sme.containers"

# Install an extension (latest version from a specific feed, if the feed is not present, it will be added)
Install-Extension -GatewayEndpoint "https://wac.contoso.com" "msft.sme.containers" -Feed "https://aka.ms/sme-extension-feed"

# Install an extension (install a specific version)
Install-Extension "https://wac.contoso.com" "msft.sme.certificate-manager" "0.133.0"

# Uninstall-Extension
Uninstall-Extension "https://wac.contoso.com" "msft.sme.containers"

# Update-Extension
Update-Extension "https://wac.contoso.com" "msft.sme.containers"

备注

必须是网关管理员才能使用 PowerShell 修改 Windows Admin Center 扩展。You must be gateway administrator to modify Windows Admin Center extensions with PowerShell.

详细了解如何使用 Windows Admin Center SDK 构建扩展Learn more about building an extension with the Windows Admin Center SDK.