背景
分公司大部分都是审核人员,审核人员基本都是排班制,没有固定电脑,哪个闲着打开登陆使用即可,同时chrome浏览器需要保持更新。 这样就遇到了一个问题,每个用户登录后都会生成自己的用户目录,随着存储的数据越来越多,加之用户量庞大,会导致默认的C盘空间越来越小。
解决思路
- 通过组策略删除长期未登陆计算机的用户
- 通过组策略分配chrome软件
配置过程
- 删除长期未登陆计算机的用户
- 新建一个组策略对象,名称为"Delete User Profile 60 Days Unlogin",
- 依次展开 策略->管理模板->系统->用户配置文件:
- 启用"在系统重新启动时,删除超过指定天数的用户配置文件", 并设置天数。
如图示:

我们也可以自己写PS脚本删除用户配置文件,脚本内容如下:
$user_profiles = Get-CimInstance -ClassName win32_userprofile
#Write-Output $user_profiles
$date = Get-Date
$days = $date.AddDays("-90")
#Write-Output $days
foreach($i in $user_profiles){
$time = $i.LastUseTime
$p = $i.LocalPath
if($p.StartsWith("C:\Users") -and $p -ne "C:\Users\Administrator" -and $p -ne "C:\Users\administrator.IMMOMO"){
if($time -lt $days){
#Write-Output $p
Get-CimInstance -ClassName win32_userprofile | ? {$_.LocalPath -eq $p} |Remove-CimInstance
}
}
}
将脚本应用到计算机启动脚本中。
- 组策略安装chrome
-
下载 GoogleChromeStandaloneEnterprise64.msi 的安装包,
https://support.google.com/chrome/a/answer/7650032?hl=zh-Hans
- 设置目录共享,将安装包放入共享目录
通过组策略安装软件和删除用户配置文件 -
创建组策略对象
依次展开 策略->软件设置->软件安装->新建->数据包:
输入所需共享安装包的完整通用命名约定 (UNC) 路径。 例如,\\ file _server\share$\file_name.msi。
-
部署方法选择"已分配":
最后,将组策略链接到相关的OU即可。
- 分配软件
- 发布软件