当前位置: 首页 > news >正文

在 Windows Server RDS 上配置用户配置文件磁盘查找对应的用户名

UPD 文件名与所有者用户进行匹配,手动将 SID 转换为用户帐户名:

Get-ADUser -Identity S-1-5-21-32549751-3956249758-2943215497-23733695

或者使用ShowUPDFolderDetails.ps1脚本,该脚本显示指定文件夹中的 UPD 文件的名称及其所有者:

$UPDShare = "\\fs01\RDSProfiles"
$UserProfiles = @()
$fc = new-object -com scripting.filesystemobject
$folder = $fc.getfolder($UPDShare)
"Username,SiD" >> export.csv
foreach ($i in $folder.files)
{
$sid = $i.Name
$sid = $sid.Substring(5,$sid.Length-10)
if ($sid -ne "template")
{
$securityidentifier = new-object security.principal.securityidentifier $sid
$user = ( $securityidentifier.translate( [security.principal.ntaccount] ) )
$UserProfile = New-Object PSObject -Property @{
UserName = $user
UPDFile=$i.Name
}
$UserProfiles += $UserProfile
}
}
$UserProfiles| select UserName, UPDFile

在 Windows Server RDS 上配置用户配置文件磁盘 (UPD)
使用windows应用程序查看

参考另一脚本

#——————————– Script ——————————–$Files = gci $UPD_Location -NameForeach ($SID in $Files) {
If ($SID -match .vhdx”) {
$SID = $SID.Substring(5) -replace .vhdx”
If ($SID-match “template”) {
Write-Host “Template File”
} Else {
$objUser = “UNKNOWN”
$UserName = “UNKNOWN”
$objSID = New-Object System.Security.Principal.SecurityIdentifier ($SID)
$objUser = $objSID.Translate( [System.Security.Principal.NTAccount])
$UserName = $objUSer.Value.trim(“$DomainName\)
$TextFile = $UPD_Location + \UVHD-” + $SID +   + $UserName + .txt”
New-Item $TextFile -ItemType file -Force
}
}
}
http://www.dtcms.com/a/284319.html

相关文章:

  • 第2章通用的高并发架构设计——2.5 高并发读场景总结:CQRS
  • 【计算机网络】第四章:网络层(上)
  • Spring中事务失效的情况深度分析
  • 深入理解 KVM 子系统:从虚拟化核心到内核实现的全景解析
  • 7.18 note
  • 第十八节:第三部分:java高级:反射-获取构造器对象并使用
  • 【参数初始化】——深度学习.全连接网络
  • Cadence SPB 2024软件下载及安装教程|Cadence软件安装详细步骤附下载链接
  • Spring IoCDI_2_使用篇
  • Anime.js 超级炫酷的网页动画库详解
  • 【图像质量评价指标】信噪比(Signal-to-Noise Ratio,SNR)
  • Linux 基础指令
  • makefile missing separator. Stop.问题
  • 一款实用的.NET Core加密解密工具类库
  • C++11之lambda表达式与包装器
  • 20.轮廓特征与近似,改变图像的轮廓识别画线的精确度,同时画出轮廓对应的矩形
  • GitHub 趋势日报 (2025年07月16日)
  • 【Burp入门第三十八篇】Repeater Strike:AI 驱动的 Burp Suite 插件
  • Effective Modern C++ 条款13:优先考虑const_iterator而非iterator
  • Magenta RT 正式开源!实时生成多种风格音乐,让创作无门槛
  • 【C++详解】STL-stack、queue的模拟实现,容器适配器,deque双端队列介绍
  • Java 大视界 -- Java 大数据在智能交通智能公交站台乘客流量预测与服务优化中的应用(349)
  • 19.删除链表的倒数第 N 个结点
  • 多线程--sem_wait(sem)特殊用法
  • 拿到安全工程师证后,能从事哪些岗位?
  • C函数实现strcopy strcat strcmp strstr
  • javax.servlet.http.HttpServletResponse;API导入报错解决方案
  • Kotlin集合与空值
  • 产品经理如何绘制流程图
  • Linux中的数据库操作基础