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

求助:通过AD GPO或PowerShell脚本配置Windows自定义性能选项未达预期

解决方案:配置Windows视觉效果(仅启用指定选项)

以下提供PowerShell脚本实现、组策略配置方案,以及脚本失效的排查要点:


PowerShell脚本实现(覆盖现有用户+新用户)

该脚本会修改当前用户、所有本地用户的配置文件,以及默认用户模板(确保新用户继承设置),仅启用指定的三个视觉效果,其余全部禁用。需以管理员身份运行:

# 1. 配置当前登录用户的视觉效果
# 设置视觉效果为自定义模式
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" -Name "VisualEffectsSetting" -Value 2 -Type DWord

# 启用指定的三个效果
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "DragFullWindows" -Value 1 -Type String
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "FontSmoothing" -Value 1 -Type String
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "FontSmoothingType" -Value 2 -Type DWord
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "SmoothScroll" -Value 1 -Type String

# 禁用其他所有视觉效果
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop\WindowMetrics" -Name "MinAnimate" -Value 0 -Type String
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "MenuShowDelay" -Value 0 -Type String
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "MenuFade" -Value 0 -Type String
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ListviewAlphaSelect" -Value 0 -Type DWord
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ListviewShadow" -Value 0 -Type DWord
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarAnimations" -Value 0 -Type DWord
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "UserPreferencesMask" -Value ([byte[]](0x9e,0x1e,0x07,0x80,0x12,0x00,0x00,0x00)) -Type Binary

# 2. 处理所有未登录的本地用户配置文件
$userProfiles = Get-WmiObject -Class Win32_UserProfile | Where-Object { $_.Special -eq $false -and $_.Loaded -eq $false }
foreach ($profile in $userProfiles) {
    $hivePath = Join-Path $profile.LocalPath "NTUSER.DAT"
    reg load HKU\TempUser $hivePath

    # 复制当前用户的视觉效果配置到该用户
    Set-ItemProperty -Path "HKU:\TempUser\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" -Name "VisualEffectsSetting" -Value 2 -Type DWord -ErrorAction SilentlyContinue
    Set-ItemProperty -Path "HKU:\TempUser\Control Panel\Desktop" -Name "DragFullWindows" -Value 1 -Type String -ErrorAction SilentlyContinue
    Set-ItemProperty -Path "HKU:\TempUser\Control Panel\Desktop" -Name "FontSmoothing" -Value 1 -Type String -ErrorAction SilentlyContinue
    Set-ItemProperty -Path "HKU:\TempUser\Control Panel\Desktop" -Name "FontSmoothingType" -Value 2 -Type DWord -ErrorAction SilentlyContinue
    Set-ItemProperty -Path "HKU:\TempUser\Control Panel\Desktop" -Name "SmoothScroll" -Value 1 -Type String -ErrorAction SilentlyContinue
    Set-ItemProperty -Path "HKU:\TempUser\Control Panel\Desktop\WindowMetrics" -Name "MinAnimate" -Value 0 -Type String -ErrorAction SilentlyContinue
    Set-ItemProperty -Path "HKU:\TempUser\Control Panel\Desktop" -Name "UserPreferencesMask" -Value ([byte[]](0x9e,0x1e,0x07,0x80,0x12,0x00,0x00,0x00)) -Type Binary -ErrorAction SilentlyContinue

    reg unload HKU\TempUser
}

# 3. 配置默认用户模板(新用户自动继承)
$defaultHivePath = Join-Path $env:SystemDrive "Users\Default\NTUSER.DAT"
reg load HKU\DefaultUser $defaultHivePath

Set-ItemProperty -Path "HKU:\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" -Name "VisualEffectsSetting" -Value 2 -Type DWord -ErrorAction SilentlyContinue
Set-ItemProperty -Path "HKU:\DefaultUser\Control Panel\Desktop" -Name "DragFullWindows" -Value 1 -Type String -ErrorAction SilentlyContinue
Set-ItemProperty -Path "HKU:\DefaultUser\Control Panel\Desktop" -Name "FontSmoothing" -Value 1 -Type String -ErrorAction SilentlyContinue
Set-ItemProperty -Path "HKU:\DefaultUser\Control Panel\Desktop" -Name "FontSmoothingType" -Value 2 -Type DWord -ErrorAction SilentlyContinue
Set-ItemProperty -Path "HKU:\DefaultUser\Control Panel\Desktop" -Name "SmoothScroll" -Value 1 -Type String -ErrorAction SilentlyContinue
Set-ItemProperty -Path "HKU:\DefaultUser\Control Panel\Desktop" -Name "UserPreferencesMask" -Value ([byte[]](0x9e,0x1e,0x07,0x80,0x12,0x00,0x00,0x00)) -Type Binary -ErrorAction SilentlyContinue

reg unload HKU\DefaultUser

# 4. 重启资源管理器使设置生效
Stop-Process -Name explorer -Force
Start-Process explorer

组策略(GPO)实现方案

用户配置(覆盖现有域/本地用户)

  1. 打开组策略管理控制台(GPMC),创建或编辑用户GPO
  2. 导航到 用户配置 > 管理模板 > 控制面板 > 显示:
    • 启用Show window contents while dragging
    • 启用Smooth edges of screen fonts(可指定ClearType)
  3. 导航到 用户配置 > 管理模板 > Windows组件 > 文件资源管理器:
    • 启用Turn off smooth-scrolling list boxes并设置为禁用(即允许启用该效果)
  4. 导航到 用户配置 > 管理模板 > Windows组件 > 文件资源管理器 > 视觉效果:
    • 启用所有需要禁用的效果策略(如Turn off taskbar animations、Turn off window animations),设置为启用(即禁用对应视觉效果)
  5. 添加注册表偏好设置:
    • 路径:HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects
    • 值名称:VisualEffectsSetting,类型DWORD,值2(自定义模式)

计算机配置(针对新用户)

  1. 编辑GPO的计算机配置
  2. 导航到 计算机配置 > 首选项 > Windows设置 > 注册表
  3. 添加默认用户的注册表项(路径前缀为Default\),复制上述用户配置的所有注册表值,确保新用户继承设置。

脚本未完全生效的排查要点

  1. 权限不足:未以管理员身份运行,导致无法修改其他用户的注册表 hive
  2. 遗漏默认用户配置:仅修改现有用户,未更新Default User模板,新用户不生效
  3. 注册表路径/键名错误:比如拼写错误(如DragFullWindows写成DragFullWindow)、值类型错误(如把DWORD设为String)
  4. 未加载用户hive:未登录的用户需加载NTUSER.DAT才能修改,直接访问HKCU仅能修改当前用户
  5. 未重启资源管理器:修改注册表后需重启explorer.exe,否则视觉效果不会立即更新
  6. 遗漏部分效果的注册表项:部分视觉效果对应HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced下的键,脚本未覆盖

内容的提问来源于stack exchange,提问作者Subba Reddy Alamur

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.14 05:10:53