使用 Windows PowerShell 和 WMI 管理 UE-V 2.1 SP1 代理和包

可以使用 Windows Management Instrumentation (WMI) 和 Windows PowerShell 来管理Microsoft用户体验虚拟化 (UE-V) 2.1 SP1 代理配置和同步行为。 有关 UE-V PowerShell cmdlet 的完整列表,请参阅 MDOP cmdlet 参考

使用 Windows PowerShell 部署 UE-V 代理

  1. 在可访问的网络共享中暂存 UE-V 安装程序文件。

    注意

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

  2. 若要安装 UE-V 代理,请使用以下 Windows 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%

使用 Windows PowerShell 配置 UE-V 代理

  1. 打开 Windows PowerShell 窗口。 若要使用 Computer 参数管理 影响计算机所有用户的计算机设置,请使用具有管理员权限的帐户打开窗口。

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

Windows PowerShell 命令 说明
Get-UevConfiguration 获取有效的 UE-V 代理设置。 特定于用户的设置优先于计算机设置。
Get-UevConfiguration -CurrentComputerUser 仅获取当前用户的 UE-V 代理设置值。
Get-UevConfiguration -Computer 获取计算机上所有用户的 UE-V 代理配置设置值。
Get-UevConfiguration -Details 获取每个配置设置的详细信息。 显示设置的配置位置,或者是否使用默认值。 如果当前设置有效,则显示 。
Set-UevConfiguration -Computer -ContactITDescription <IT description> 设置帮助链接的公司设置中心中显示的文本。
Set-UevConfiguration -Computer -ContactITUrl <string> 在帮助链接的公司设置中心设置链接的 URL。 可以使用任何 URL 协议。
Set-UevConfiguration -Computer -EnableDontSyncWindows8AppSettings 将 UE-V 代理配置为不同步计算机上的所有用户的任何 Windows 应用。
Set-UevConfiguration -CurrentComputerUser -EnableDontSyncWindows8AppSettings 将 UE-V 代理配置为不同步当前计算机用户的任何 Windows 应用。
Set-UevConfiguration -Computer -EnableFirstUseNotification 将 UE-V 代理配置为在首次为计算机上的所有用户运行代理时显示通知。
Set-UevConfiguration -Computer -DisableFirstUseNotification 将 UE-V 代理配置为首次针对计算机上的所有用户运行代理时不显示通知。
Set-UevConfiguration -Computer -EnableSettingsImportNotify 将 UE-V 代理配置为在设置同步延迟时通知计算机上的所有用户。 使用 DisableSettingsImportNotify 参数禁用通知。
Set-UevConfiguration -CurrentComputerUser -EnableSettingsImportNotify 将 UE-V 代理配置为在设置同步延迟时通知当前用户。 使用 DisableSettingsImportNotify 参数禁用通知。
Set-UevConfiguration -Computer -EnableSyncUnlistedWindows8Apps 将 UE-V 代理配置为同步所有未由 Windows 应用列表显式禁用的计算机用户的所有 Windows 应用。 DisableSyncUnlistedWindows8Apps使用 参数将 UE-V 代理配置为仅同步由 Windows 应用列表显式启用的 Windows 应用。
Set-UevConfiguration -CurrentComputerUser -EnableSyncUnlistedWindows8Apps 将 UE-V 代理配置为同步计算机上当前用户的 Windows 应用列表未显式禁用的所有 Windows 应用。 DisableSyncUnlistedWindows8Apps使用 参数将 UE-V 代理配置为仅同步由 Windows 应用列表显式启用的 Windows 应用。
Set-UevConfiguration -Computer -DisableSync 为计算机上的所有用户禁用 UE-V。 使用 EnableSync 参数启用或重新启用。
Set-UevConfiguration -CurrentComputerUser -DisableSync 在计算机上的当前用户禁用 UE-V。 使用 EnableSync 参数启用或重新启用。
Set-UevConfiguration -Computer -EnableTrayIcon 在通知区域中为计算机的所有用户启用 UE-V 图标。 使用 DisableTrayIcon 参数禁用图标。
Set-UevConfiguration -Computer -MaxPackageSizeInBytes <size in bytes> 将 UE-V 代理配置为在设置包文件大小达到计算机上所有用户定义的阈值时进行报告。 设置阈值包大小(以字节为单位)。
Set-UevConfiguration -CurrentComputerUser -MaxPackageSizeInBytes <size in bytes> 将 UE-V 代理配置为在设置包文件大小达到定义的阈值时进行报告。 设置当前用户的包大小警告阈值。
Set-UevConfiguration -Computer -SettingsImportNotifyDelayInSeconds 为计算机的所有用户指定通知用户之前的时间(以秒为单位)。
Set-UevConfiguration -CurrentComputerUser -SettingsImportNotifyDelayInSeconds 指定发送当前用户的通知之前的时间(以秒为单位)。
Set-UevConfiguration -Computer -SettingsStoragePath <path to settings storage location> 为计算机的所有用户定义每台计算机设置存储位置。
Set-UevConfiguration -CurrentComputerUser -SettingsStoragePath <path to settings storage location> 定义每用户设置存储位置。
Set-UevConfiguration -Computer -SettingsTemplateCatalogPath <path to catalog> 为计算机的所有用户设置设置模板目录路径。
Set-UevConfiguration -Computer -SyncMethod <sync method> 为计算机的所有用户设置同步方法:SyncProvider 或 None。
Set-UevConfiguration -CurrentComputerUser -SyncMethod <sync method> 设置当前用户的同步方法:SyncProvider 或 None。
Set-UevConfiguration -Computer -SyncTimeoutInMilliseconds <timeout in milliseconds> 为计算机的所有用户设置同步超时(以毫秒为单位)。
Set-UevConfiguration -CurrentComputerUser -SyncTimeoutInMilliseconds <timeout in milliseconds> 设置当前用户的同步超时。
Clear-UevConfiguration -Computer -<setting name> 清除计算机上的所有用户的指定设置。
Clear-UevConfiguration -CurrentComputerUser -<setting name> 仅清除当前用户的指定设置。
Export-UevConfiguration <settings migration file> 将 UE-V 计算机配置导出到设置迁移文件。 文件扩展名必须为 .uevExport cmdlet 导出所有使用 Computer 参数配置的 UE-V 代理设置。
Import-UevConfiguration <settings migration file> 从设置迁移文件导入 UE-V 计算机配置。 文件扩展名必须为 .uev

使用 Windows PowerShell 导出 UE-V 包设置和修复 UE-V 模板

  1. 以管理员身份打开 Windows PowerShell 窗口。

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

    Windows PowerShell 命令 说明
    Export-UevPackage MicrosoftCalculator6.pkgx 从 Microsoft 计算器包文件中提取设置,并将其转换为 XML 中可读的格式。
    Repair-UevTemplateIndex 修复 UE-V 设置位置模板的索引。

使用 WMI 配置 UE-V 代理

  1. 用户体验虚拟化提供以下 WMI 命令集。 管理员可以使用此接口在命令行配置 UE-V 代理,并自动执行典型的配置任务。

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

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

    Windows PowerShell 命令 说明
    Get-WmiObject -Namespace root\Microsoft\UEV Configuration 显示活动的 UE-V 代理设置。 特定于用户的设置优先于计算机设置。
    Get-WmiObject -Namespace root\Microsoft\UEV UserConfiguration 显示为用户定义的 UE-V 代理配置。
    Get-WmiObject -Namespace root\Microsoft\UEV ComputerConfiguration 显示为计算机定义的 UE-V 代理配置。
    Get-WmiObject -Namespace root\Microsoft\Uev ConfigurationItem 显示每个配置项目的详细信息。
    $config = Get-WmiObject -Namespace root\Microsoft\UEV ComputerConfiguration
    $config.SettingsStoragePath = <path_to_settings_storage_location>
    $config.Put()
    定义每台计算机设置存储位置。
    $config = Get-WmiObject -Namespace root\Microsoft\UEV UserConfiguration
    $config.SettingsStoragePath = <path_to_settings_storage_location>
    $config.Put()
    定义每用户设置存储位置。
    $config = Get-WmiObject -Namespace root\Microsoft\UEV ComputerConfiguration
    $config.SyncTimeoutInMilliseconds = <timeout_in_milliseconds>
    $config.Put()
    为计算机的所有用户设置同步超时(以毫秒为单位)。
    $config = Get-WmiObject -Namespace root\Microsoft\UEV ComputerConfiguration
    $config.MaxPackageSizeInBytes = <size_in_bytes>
    $config.Put()
    将 UE-V 代理配置为在设置包文件大小达到定义的阈值时进行报告。 为计算机的所有用户设置阈值包文件大小(以字节为单位)。
    $config = Get-WmiObject -Namespace root\Microsoft\UEV ComputerConfiguration
    $config.SyncMethod = <sync_method>
    $config.Put()
    为计算机的所有用户设置同步方法:SyncProvider 或 None。
    $config = Get-WmiObject -Namespace root\Microsoft\UEV ComputerConfiguration
    $config.<setting name> = $true
    $config.Put()
    若要启用特定的每台计算机设置,请清除设置,并使用 $null 作为设置值。 对每用户设置使用 UserConfiguration。
    $config = Get-WmiObject -Namespace root\Microsoft\UEV ComputerConfiguration
    $config.<setting name> = $false
    $config.Put()
    若要禁用特定的每台计算机设置,请清除设置,并使用 $null 作为设置值。 将用户配置用于每用户设置。
    $config = Get-WmiObject -Namespace root\Microsoft\UEV ComputerConfiguration
    $config.<setting name> = <setting value>
    $config.Put()
    更新特定的每台计算机设置。 若要清除设置,请使用 $null 作为设置值。
    $config = Get-WmiObject -Namespace root\Microsoft\UEV ComputerConfiguration
    $config.<setting name> = <setting value>
    $config.Put()
    为计算机的所有用户更新特定的每用户设置。 若要清除设置,请使用 $null 作为设置值。

使用 WMI 和 Windows PowerShell 配置 UE-V 代理时,定义的配置将存储在注册表中的以下位置。

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

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

使用 WMI 导出 UE-V 包设置和修复 UE-V 模板

  1. UE-V 提供以下 WMI 命令集。 管理员可以使用此接口导出包或修复 UE-V 模板。

  2. 使用以下 WMI 命令。

    WMI 命令 说明
    Invoke-WmiMethod -Namespace root\Microsoft\UEV -Class UserSettings -Name ExportPackage -ArgumentList <package name> 从包文件中提取设置,并将其转换为 XML 中的用户可读格式。
    Invoke-WmiMethod -Namespace root\Microsoft\UEV -Class SettingsLocationTemplate -Name RebuildIndex 修复 UE-V 设置位置模板的索引。 必须以管理员身份运行。

使用 Windows PowerShell 和 WMI 管理 UE-V 2.1 SP1

管理 UE-V 2.1 SP1