在 Windows PowerShell 中使用 VAMT

批量激活管理工具 (VAMT) PowerShell cmdlet 可用于执行与 Vamt.exe 命令行工具相同的功能。

在 Windows PowerShell 中配置 VAMT

安装 PowerShell 3.0

VAMT PowerShell cmdlet 需要Windows PowerShell(包含在 Windows 10、Windows 8 和 Windows Server® 2012 中)。 可以从 Microsoft 下载中心下载适用于 Windows 7 或其他操作系统的 PowerShell。

安装 Windows 评估和部署工具包**

除了 PowerShell,还必须导入 VAMT PowerShell 模块。 安装 Windows 评估和部署工具包后,该模块将包含在 VAMT 3.0 文件夹中, (Windows ADK) 。

准备 VAMT PowerShell 环境

若要使用管理凭据打开 PowerShell,请选择“ 开始 ”并输入 PowerShell 以查找程序。 右键单击“Windows PowerShell”,然后选择“以管理员身份运行”。 若要在 Windows 7 中打开 PowerShell,请选择“开始”,选择“所有程序”,选择“附件”,选择“Windows PowerShell”,右键单击“Windows PowerShell”,然后选择“以管理员身份运行”。

重要提示

如果使用的是具有 64 位处理器的计算机,请选择Windows PowerShell (x86) 。 仅 x86 体系结构支持 VAMT PowerShell cmdlet。 必须使用 x86 版本的 Windows PowerShell 才能导入 VAMT 模块

以下目录中提供了 x86 版本的 Windows PowerShell:

  • PowerShell:

    C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe

  • PowerShell ISE:

    C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell_ise.exe

对于所有受支持的操作系统,可以使用 Windows ADK 附带的 VAMT PowerShell 模块。 默认情况下,模块随 VAMT 文件夹中的 Windows ADK 一起安装。 将目录更改为 VAMT 所在的目录。 例如,如果 Windows ADK 安装在 的默认位置 C:\Program Files(x86)\Windows Kits\10,请输入:

cd "C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\VAMT3"

导入 VAMT PowerShell 模块

若要导入 VAMT PowerShell 模块,请在 PowerShell 命令提示符处输入以下命令:

Import-Module .\VAMT.psd1

其中 ,Import-Module 仅将模块导入当前会话。 若要将模块导入所有会话,请将 Import-Module 命令添加到Windows PowerShell配置文件。 有关配置文件的详细信息,请输入 get-help about_profiles

获取有关 VAMT PowerShell cmdlet 的帮助

可以查看 VAMT PowerShell cmdlet 的所有帮助部分,也可以仅查看感兴趣的部分。 若要查看 VAMT cmdlet 的所有帮助内容,请输入:

get-help <cmdlet name> -all

例如,输入:

get-help get-VamtProduct -all

警告

VAMT PowerShell cmdlet 不支持 update-help cmdlet。 若要查看 VAMT cmdlet 的联机帮助,可以将 -online 选项与 cmdlet 配合使用 get-help 。 有关详细信息,请参阅 Windows PowerShell 中的 批量激活管理工具 (VAMT) Cmdlet

查看 VAMT PowerShell 帮助部分

  1. 若要获取用于 cmdlet 的语法,请在 PowerShell 命令提示符处输入以下命令:

    get-help <cmdlet name>
    

    例如,输入:

    get-help get-VamtProduct 
    
  2. 若要查看使用 cmdlet 的示例,请输入:

    get-help <cmdlet name> -examples
    

    例如,输入:

    get-help get-VamtProduct -examples