如何获取您在PowerShell中扫描的文件的网络用户的AD全名

时间:2018-07-06 08:50:41

标签: powershell

当前,我用于扫描网络用户全名的代码如下所示,但是它仅输出用于扫描文件的设备的全名,而不是创建文件的人的全名。有人帮忙吗?谢谢!

 $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='Full Name of Net User';Expression={([adsi]"WinNT://$env:userdomain/$env:username,user").fullname}},
                              CreationTime, 
                              LastWriteTime, 
                              @{N='Last Created Within (Number of Days)';E={$NumberOfDays}},
                              @{N="Location";E={$Row.country}}       
}

0 个答案:

没有答案