Query owner of a file or folder using PowerShell

It can often be interesting to find out who owns a file or folder . As is known, this is done via the file properties , as you can see in the image below.

Owner display in Explorer

In the picture you can see that the user ” Windows FAQ ” is the owner of the file ” C: Temp Liste.txt “.

You can perform this query much faster and more comfortably using the following PowerShell commands.

Query owner of a file using PowerShell

If you only want to query the owner of a file using PowerShell, the following command should be used.

gci “C: Temp Liste.txt” -directory | select Fullname, @ {n = ‘Owner’; e = {(get-acl $ _. Fullname) .Owner}}

Owner display in Explorer

All you have to do is adjust the path or folder name in the PowerShell script line and the short command line throws out the owner of the specified file.

Show owner of multiple folders via PowerShell

The PowerShell script works somewhat modified for a directory and shows you all the owners of the subfolders of a directory . The PowerShell command line is as follows.

gci “C: Windows” Directory | select Fullname, @ {n = ‘Owner’; e = {(get-acl $ _. Fullname) .Owner}}

We have also illustrated this process below.

Owner of the Windows folder including subdirectories

As you can see, we only exchanged the folder and file name with a path . In this case, then the PowerShell command lists all Unterzeichnisse the specified directory and its owner or owners on.

In this simple way, you can quickly and easily determine the owner of folders and files . Of course, these outputs can also be output in a log file for later evaluation .

If you are interested in other useful PowerShell commands , we also recommend the following posts here on our Windows FAQ blog .

– Query all RAM information using PowerShell
– Change the transparent display of the command prompt or the PowerShell console
– Software inventory using the PowerShell command
– Get Hyper-V information about a VM using PowerShell
– List all deactivated AD accounts using PowerShell – Query
members of an AD group using PowerShell
– Count the number of AD (Active Directory) objects
using PowerShell
– Enable Windows printer using the PowerShell command – Change the start type of Windows services using PowerShell

administrator