使用 PowerShell 和 WMI 管理 UE-V 1.0 Agent 和包

应用到: User Experience Virtualization 1.0

你可以使用 WMI 和 PowerShell 管理 Microsoft User Experience Virtualization (UE-V) Agent 配置和同步行为。

如何使用 PowerShell 部署 UE-V Agent

  1. 将 UE-V 安装程序文件安排在可访问的网络共享上。

    备注

    使用 AgentSetup.exe 部署 32 位和 64 位版本的 UE-V Agent。 Windows Installer 文件版本、AgentSetupx86.msi 以及 AgentSetupx64.msi 可用于每个体系结构。 要稍后使用安装文件卸载 UE-V Agent,你必须使用相同的文件类型。

  2. 使用以下其中一个 PowerShell 命令安装代理。

    & AgentSetup.exe /quiet /norestart /log "%temp%\UE-VAgentInstaller.log" SettingsStoragePath=\\server\settingsshare\%username%

    & msiexec.exe /i "<path to msi file>" /quiet /norestart /l*v "%temp%\UE-VAgentInstaller.log" SettingsStoragePath=\\server\settingsshare\%username%

如何使用 PowerShell 配置 UE-V Agent

  1. 使用具有管理员权限的帐户打开 PowerShell 窗口。 使用以下命令导入 UE-V PowerShell 模块。

    Import-module UEV
    
  2. 使用以下 PowerShell 命令配置代理。

    PowerShell 命令

    描述

    Get-UevConfiguration

    查看有效的 UE-V Agent 设置。 特定于用户的设置优先于计算机设置。

    Get-UevConfiguration - CurrentComputerUser

    查看仅适用于当前用户的 UE-V Agent 设置值。

    Get-UevConfiguration -Computer

    在计算机上查看适用于所有用户的 UE-V Agent 配置设置值。

    Set-UevConfiguration -Computer -SettingsStoragePath <设置存储位置的路径>

    定义每台计算机的设置存储位置。

    Set-UevConfiguration -CurrentComputerUser -SettingsStoragePath <设置存储位置的路径>

    定义每个用户的设置存储位置。

    Set-UevConfiguration -Computer -SyncTimeoutInMilliseconds <超时(以毫秒为单位)>

    设置同步超时(以毫秒为单位)

    Set-UevConfiguration -CurrentComputerUser -SyncTimeoutInMilliseconds <超时(以毫秒为单位)>

    为当前用户设置同步超时。

    Set-UevConfiguration -Computer -MaxPackageSizeInBytes <大小字节数>

    将 UE-V Agent 配置为在设置包文件大小达到定义的阈值时进行报告。 设置阈值包大小字节数。

    Set-UevConfiguration -CurrentComputerUser -MaxPackageSizeInBytes <大小字节数>

    为当前用户设置包大小警告阈值。

    Set-UevConfiguration –Computer –SettingsTemplateCatalogPath <目录路径>

    对设置模板目录路径进行设置。

    Set-UevConfiguration -Computer -SyncMethod <同步方法>

    设置同步方法: OfflineFiles 或无。

    Set-UevConfiguration -CurrentComputerUser -SyncMethod <同步方法>

    为当前用户设置同步方法: OfflineFiles 或无。

    Set-UEVConfiguration -Computer –EnableSettingsImportNotify

    实现在导入用户设置延迟时发出通知。

    使用 –DisableSettingsImportNotify 禁用通知。

    Set-UEVConfiguration - CurrentComputerUser -EnableSettingsImportNotify

    实现在导入用户设置延迟时通知当前用户。

    使用 –DisableSettingsImportNotify 禁用通知。

    Set-UEVConfiguration -Computer -SettingsImportNotifyDelayInSeconds

    指定通知用户之前等待的时间(以秒为单位)

    Set-UEVConfiguration - CurrentComputerUser -SettingsImportNotifyDelayInSeconds

    指定通知当前用户之前等待的时间(以秒为单位)。

    Set-UevConfiguration –Computer –DisableSync

    在计算机上对所有用户禁用 UE-V。

    使用 –EnableSync 启用或重新启用。

    Set-UevConfiguration –CurrentComputerUser -DisableSync

    在计算机上对当前用户禁用 UE-V。

    使用 –EnableSync 启用或重新启用。

    Clear-UevConfiguration –Computer -<设置名称>

    清除计算机上所有用户的特定设置。

    Clear-UevConfiguration –CurrentComputerUser -<设置名称>

    仅清除当前用户的特定设置。

    Export-UevConfiguration <设置迁移文件>

    将 UE-V 计算机配置导出到设置迁移文件。 文件的扩展名必须是“.uev”。

    导出 cmdlet 将导出可用 -computer 参数配置的所有 UE-V Agent 设置。

    Import-UevConfiguration <设置迁移文件>

    从设置迁移文件(.uev 文件)中导入 UE-V 计算机配置。

如何用 PowerShell 导出 UE-V 包设置和修复 UE-V 模板

  1. 以管理员身份打开 PowerShell 窗口。 使用以下命令导入 UE-V PowerShell 模块。

    Import-module UEV
    
  2. 使用以下 PowerShell 命令配置代理。

    PowerShell 命令

    描述

    Export-UevPackage MicrosoftCalculator6.pkgx

    从 Microsoft Calculator 包文件中提取设置并以 XML 将它们转化成用户可读的格式。

    Repair-UevTemplateIndex

    修复 UE-V 设置位置模板的索引。

如何使用 WMI 配置 UE-V Agent

  1. User Experience Virtualization提供以下 WMI 命令集。 管理员可以使用此界面通过命令行配置 UE-V Agent 并自动执行典型的配置任务。

    使用具有管理员权限的帐户打开 PowerShell 窗口。

  2. 使用以下 WMI 命令配置代理。

    PowerShell 命令 描述

    Get-WmiObject -Namespace root\Microsoft\UEV Configuration

    查看活动的 UE-V Agent 设置。 特定于用户的设置优先于计算机设置。

    Get-WmiObject -Namespace root\Microsoft\UEV UserConfiguration

    查看为用户定义的 UE-V Agent 配置。

    Get-WmiObject -Namespace root\Microsoft\UEV ComputerConfiguration

    查看为计算机定义的 UE-V Agent 配置。

    $config = Get-WmiObject -Namespace root\Microsoft\UEV ComputerConfiguration

    $config.SettingsStoragePath = <设置存储位置的路径>

    $config.Put()

    定义每台计算机的设置存储位置。

    $config = Get-WmiObject -Namespace root\Microsoft\UEV UserConfiguration

    $config.SettingsStoragePath = <设置存储位置的路径>

    $config.Put()

    定义每个用户的设置存储位置。

    $config = Get-WmiObject -Namespace root\Microsoft\UEV ComputerConfiguration

    $config.SyncTimeoutInMilliseconds = <超时(以毫秒为单位)>

    $config.Put()

    设置同步超时(以毫秒为单位)。

    $config = Get-WmiObject -Namespace root\Microsoft\UEV ComputerConfiguration

    $config.MaxPackageSizeInBytes = <大小(以字节为单位)>

    $config.Put()

    将 UE-V Agent 配置为在设置包文件大小达到定义的阈值时进行报告。 设置阈值包文件大小字节数。

    $config = Get-WmiObject -Namespace root\Microsoft\UEV ComputerConfiguration

    $config.SyncMethod = <同步方法>

    $config.Put()

    设置同步方法: OfflineFiles 或无。

    $config = Get-WmiObject -Namespace root\Microsoft\UEV ComputerConfiguration

    $config.<设置名称> = <设置值>

    $config.Put()

    更新每台计算机的特定设置。 要清除该设置,请将 $null 用作设置值。

    $config = Get-WmiObject -Namespace root\Microsoft\UEV ComputerConfiguration

    $config.<设置名称> = <设置值>

    $config.Put()

    更新每个用户的特定设置。 要清除该设置,请将 $null 用作设置值。

    在使用 WMI 和 PowerShell 配置 UE-V Agent 后,定义的配置会存储在注册表内的以下位置中:

    \HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\UEV\Agent\Configuration

    \HKEY_CURRENT_USER\SOFTWARE\Microsoft\UEV\Agent\Configuration

另请参阅

其他资源

管理 UE-V 1.0
UE-V 1.0 的操作

-----
你可以在 TechNet 库中了解有关 MDOP 的详细信息、在 TechNet Wiki 上搜索疑难解答,或者在 FacebookTwitter 上了解我们的最新信息。
-----