Find file / folder owner information using PowerShell or command prompt

PowerShell

GET-ACL $Path | Select Path, Owner -expand access

where “$Path” could be a variable of the folder path or you can replace with the value like “c:\temp”

image

 

If you notice, the Path attribute has some unwanted value ‘Microsoft.PowerShell.Core\Filesystem’::’  To further format the output, we can modify the above command as:

GET-ACL “$Path”| select path, Owner -expand access | select @{n=”Path”;e={$_.Path.replace(“Microsoft.PowerShell.Core\FileSystem::”,””)}}, Owner, IdentityReference, FileSystemRights, AccessControlType, IsInherited

image

 

Command Prompt

DIR command switches have not been explored to the core. The DIR command not only lists all available files and directories in the current directory but also can show the last modification date and time, file size and lot more.

All we need to do is run the below command to find the owner of the folder

DIR /Q <Folder Path>

Add the /S switch to browse through the subdirectories and files

Add the /AD switch to list only the directories

image