Users (Owners)
dir /q <file>
Owner
forfiles /S /M "*.*" /C "cmd /c whoami /fo owner %p"
Recursive
icacls "C:\Windows\System32\cmd.exe"
Includes owner
Get-Acl
Owner is part of the ACL
Get-Acl <Path> | Select-Object -ExpandProperty Owner
Gets the owner of the file or directory at the specified path.
Recursive:
Get-ChildItem <Path> -Recurse | ForEach-Object { Get-Acl $_.FullName } | Select-Object Path, Owner
Specific directory:
Get-ChildItem <Path> -File | Get-Acl | Select-Object -ExpandProperty Owner
Last updated
Was this helpful?