ardi Posted February 22, 2010 Share Posted February 22, 2010 I've had horrible results trying to get ownership and control over files. I'm the only user/admin yet sometimes I cannot change ownership of files brought from a flash drive. One error I get is "cannot determine current owner." So I can't use or delete files I've just imported.Really, what I'm looking for is a very good resource to study. I know it's out there, and someone knows what to do when the thing does not respond as described. What is the nuclear option to get control of files? Link to comment Share on other sites More sharing options...
MagicAndre1981 Posted February 22, 2010 Share Posted February 22, 2010 Use the tool TakeControl from XPero. Link to comment Share on other sites More sharing options...
gunsmokingman Posted February 22, 2010 Share Posted February 22, 2010 Or you could try this script to take ownership of the fileSave As OwnTheFile.vbsDim Act : Set Act = CreateObject("Wscript.Shell")Dim Obj For Each Obj in Wscript.Arguments Act.Run("takeown /f " & Obj),0,True Act.Run("icacls " & Obj & " /grant administrators:F"),0,True Next Link to comment Share on other sites More sharing options...
MagicAndre1981 Posted February 22, 2010 Share Posted February 22, 2010 your script only works on english Windows version. Link to comment Share on other sites More sharing options...
MrJinje Posted February 22, 2010 Share Posted February 22, 2010 (edited) Attachment in post three is a multi-lingual right click shell extension version. Windows Registry Editor Version 5.00[HKEY_CLASSES_ROOT\*\shell\runas]@="Take Ownership""NoWorkingDirectory"=""[HKEY_CLASSES_ROOT\*\shell\runas\command]@="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant *S-1-5-32-544:F""IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant *S-1-5-32-544:F"[HKEY_CLASSES_ROOT\Directory\shell\runas]@="Take Ownership""NoWorkingDirectory"=""[HKEY_CLASSES_ROOT\Directory\shell\runas\command]@="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant *S-1-5-32-544:F /t""IsolatedCommand"="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant *S-1-5-32-544:F /t"S-1-5-32-544 is the well-known sid of the "Administrators" local group. So this should work as well.Dim Act : Set Act = CreateObject("Wscript.Shell")Dim Obj For Each Obj in Wscript.Arguments Act.Run("takeown /f " & Obj),0,True Act.Run("icacls " & Obj & " /grant *S-1-5-32-544:F"),0,True Next Edited February 22, 2010 by MrJinje Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now