我正在尝试扫描文件的所有者,但不是“域\用户名”格式,而是想访问AD并获取全名作为输出。我尝试获取输出的代码如下:
$Output = ForEach($Row in $LocContent){
Get-ChildItem $Row.drivePath -Force -Recurse |
Where-Object LastWriteTime -gt (Get-Date).AddDays(-$NumberOfDays) |
Where-Object {($_.Extension -in $Extensions)} |
Where-Object {$_.length/$SizeOfFile -gt 1} |
Select-Object -Property @{N='File Basename';E={$_.BaseName}},
@{N='File Extension';E={$_.Extension}},
@{N='size(MB)';E={[Math]::Round(($_.Length/1024kb),2)}},
Directory,
@{Name="Owner";Expression={([adsi]"WinNT://(Get-ACL $_.Fullname).Owner),user").fullname}},
CreationTime,
LastWriteTime,
@{N='Last Created Within (Number of Days)';E={$NumberOfDays}},
@{N="Location";E={$Row.country}}
}
“ Name =“ Owner”行是我要生成网络用户全名的位置,但最后不输出任何内容。如何解决该问题,以便它能显示文件名创建者。谢谢!