0

I am trying to figure out who the owner of a windows drive is through the command line and cannot seem to find the right command to run.

I know about the takeown command to take ownership of a drive, but I would like to know who the owner is before I run this command to know if the command needs to be run. The wmic logicaldisk command conveniently leaves out the drive owner.

Anther related question: Who is the default owner of an external drive? Is it the Administrators group?

2
  • The default owner of a drive will depend on the configuration of the system.
    – Ramhound
    Mar 26, 2014 at 16:49
  • @Ramhound: hmm ok. I was hoping it always defaulted to one value. I dont want to muck around with drive ownership if the user deliberately has it set up a certain way.
    – user972276
    Mar 26, 2014 at 18:33

2 Answers 2

4

It's fairly easy with PowerShell:

PS C:\> Get-Acl C:\ | Select-Object Owner

Owner
-----
NT SERVICE\TrustedInstaller

Source

0
3

You can get this information using the AccessChk tool from SysInternals site.

C:> .\accesschk.exe -d c:\ -l -q | findstr OWNER
  OWNER: NT SERVICE\TrustedInstaller
  • The -d parameter is used to only process directories or top-level keys
  • The -q parameter suppresses the tools output banner
  • The -l parameter is used to show the full access control list and is needed to get the OWNER information

Using the -l parameter will output more information that than just the OWNER information therefore the output is piped into the findstr tool to get just that information.

NOTE that you need the backslash after the drive letter otherwise the tool will ignore the drive letter and process the current directory. It is best to leave off the findstr part of the command until you have verified the output of the tool and make sure it has correctly identified the object you are looking for.

1
  • Thanks for your answer! I was going to add this functionality to a batch script and did not really want to have to reference a downloaded 3rd party exe. I should be able to use powershell as the other answer suggests.
    – user972276
    Mar 26, 2014 at 18:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.