SOLVED Need Administrator to delete?

Joined
Mar 25, 2010
Messages
150
Reaction score
2
Hi,
Running W7 Ultimate.
I have an External Hard Disk I used when I transferred my files from old computer to new. I have recently been trying to clear out what is on the Hard Disk.

I have a folder titled Windows 2.01GB I did not think I needed anymore to run my operating system so I tried to delete it. I got the message:
"You need permission to perform this action. You require permission from Administrator to make changes to this folder. Date created 20/10/09"

This is one area I am very vague about since I am the only one using my computer, I have never looked into it. Can anyone tell me how I go about getting Admistrator permission since I am the Admistrator??:)
Thank you.
 

Elmer BeFuddled

Resident eejit
Joined
Jun 12, 2010
Messages
1,048
Reaction score
251
You can add a "Take Ownership" to your context menu by saving this code as a .reg file and merging it into your registry. Should only be used to take ownership of files/folders you need to, not recommended to take ownership of your C:\ drive for example.
Code:
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\runas]
@="Take Ownership"
"HasLUAShield"=""
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\*\shell\runas\command]
@="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"


[HKEY_CLASSES_ROOT\dllfile\shell\runas]
@="Take Ownership"
"HasLUAShield"=""
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\dllfile\shell\runas\command]
@="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"


[HKEY_CLASSES_ROOT\Directory\shell\runas]
@="Take Ownership"
"HasLUAShield"=""
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\Directory\shell\runas\command]
@="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"


[HKEY_CLASSES_ROOT\Drive\shell\runas]
@="Take Ownership"
"HasLUAShield"=""
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\Drive\shell\runas\command]
@="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"


[HKEY_CLASSES_ROOT\exefile\shell\runas]
@="Take Ownership"
"HasLUAShield"=""
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\exefile\shell\runas\command]
@="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
Then right click the offending folder, select Take Ownership and a command prompt window will open, do its thing, then close. You should now have ownership of the folder and can do as you want.

A good indicator to see if you need permission to change the name or delete a file or folder is to see if there is the "LUA shield" icon next to the Rename and Delete context menu entries.
 
Last edited:
Joined
Mar 9, 2011
Messages
3
Reaction score
0
Hi Elmer - I happened to have the same problem right now, trying to delete a directory I had created as an Administrator, but now cannot delete, and sure 'nuff, there is the "LUA shield" icon next to the Rename and Delete context menu entries.

I've cut and pasted your code to a notepad, and will rename it to a .reg, but I'm hesitant to run it yet... what exactly does the code do? Is there anything in there that needs to be edited, or is this code going to just add a "Take Ownership" event to the context menu?

Also, how do I "merge the code into the registry"?

Signed - Whats Up, Doc? :)
 
Joined
Mar 9, 2011
Messages
3
Reaction score
0
No sooner did I post my post than you went offline <thats what happens when we are on opposite sides of the world!> - so I took a chance and ran the .reg, and was eventually able to delete that horrible directory that wouldn't go away. It was actually created by accident... I had ran an old xcopy .bat file to make a directory and copy files to it that I used to use in XP, but it caused really strange results in Windows 7. That's why I needed to delete it. I just discovered "Robocopy" and will start using that instead.

Still, any additional info you can give me on the Registry changes I've made would be awesome. Cheers!!
 

Elmer BeFuddled

Resident eejit
Joined
Jun 12, 2010
Messages
1,048
Reaction score
251
Hi Becky1234.
All the reg file does is give you Administrators rights over the various files and folders usually locked by the system ("you don't have permission etc...."). You could do exactly the same by using command prompt and manually entering the instructions. This just automates the commands. Or you could change the permissions/take ownership through the file/folders Properties >> Security tab.

Works on files, folders and drives (but don't use on your system drive! just individual stuff). There's nothing "naughty" in there and it works, well, because it does!!
 
Joined
Mar 9, 2011
Messages
3
Reaction score
0
Elmer - I know this is a little off topic, but WHY does Windows 7 not treat me like an Administrator? I'm of course in the Administrator Group, but sometimes the OS won't let me run an installer or a .bat file without right clicking the file and selecting "Run as administrator." And of course not being able to delete the directory that I created today (by running a .bat file as administrator). Do you know what MS had in mind by implementing Win7 this way? Thanks!
 

Elmer BeFuddled

Resident eejit
Joined
Jun 12, 2010
Messages
1,048
Reaction score
251
It's all down to Windows 7 enhanced security (I believe). If only the "True Administrator" can change things then neither you nor any bad guys can theoretically mess with your system files.
 
Last edited:
Joined
Mar 25, 2010
Messages
150
Reaction score
2
Thanks all! I have installed Take Ownership and looked it over and decided I need about a week to figure it all out. Since I don't have that time right now I will put it on hold a few days.
Thanks again, I will get there in the end with all the help.
 

TrainableMan

^ The World's First ^
Moderator
Joined
May 10, 2010
Messages
9,361
Reaction score
1,587
Once it's installed, you simply open windows explorer and find the folder in the directory tree. Then right-click and choose the "Take Ownership" option. This script may run as long as 15-20 minutes on huge folder trees but usually much less. When it finishes you should have the authority to delete it. Please be sure this is some old folder and not a needed system file of some sort.
 
Joined
Mar 25, 2010
Messages
150
Reaction score
2
Thanks Trainable Man. I installed the Take Ownership which gave me a desktop link. I clicked Computer. pulled up my External HD>found Windows>R clicked & chose Take Ownership and the black window came up and zipped thru a lot of code and finished.

I then found the file again, clicked delete and still get the message I need to have Admistrator permissions.
Obviously I missed something.
 

davehc

Microsoft MVP
Joined
Jul 20, 2009
Messages
1,957
Reaction score
502
The computer does not recognise your external contents as the "Trusted Owner"
Go to the folder and right-click choose Properties.
Click on the Security tab and then click on the Advanced button at the bottom.

Next click on the Owner tab and you will probably see that the current owner is TrustedInstaller.
Click on the Edit button and choose who you would like to change the owner to, either your account(name) or the Administrator.
If your account is an Administrator account, just pick Administrators.
Tick "Replace owner on subcontainers and objects", if you need to delete more than one file in a folder.(As you do!) Click OK. Now the Current owner is the account you picked.
Click OK until you have closed all properties windows and are back to the Windows Explorer screen.
Right-click on the folder or file again and choose Properties again.
Click on the user name in the list that you want to change the permissions for, which should be the same as who you changed the current owner too.
If the user name is not in the list, click Add, type in the name and click OK.
Click on the check box next to Full Control. All the other boxes will become checked too.
Click OK once and then click OK one more time to get back to Windows Explorer.
You should now be able to delete the folder and files.
 
Joined
Mar 25, 2010
Messages
150
Reaction score
2
The computer does not recognise your external contents as the "Trusted Owner"
Go to the folder and right-click choose Properties.
Click on the Security tab and then click on the Advanced button at the bottom.

Next click on the Owner tab and you will probably see that the current owner is TrustedInstaller.
Click on the Edit button and choose who you would like to change the owner to, either your account(name) or the Administrator.
If your account is an Administrator account, just pick Administrators.
Tick "Replace owner on subcontainers and objects", if you need to delete more than one file in a folder.(As you do!) Click OK. Now the Current owner is the account you picked.
Click OK until you have closed all properties windows and are back to the Windows Explorer screen.

I think I am ok to here.
Right-click on the folder or file again and choose Properties again.
Click on the user name in the list that you want to change the permissions for, which should be the same as who you changed the current owner too.
Since I just changed ownership to Administrator, why am I looking to change permissions again and also, who is now the user?
If the user name is not in the list, click Add, type in the name and click OK.
Click on the check box next to Full Control. All the other boxes will become checked too. I notice the administrator on the list does not allow for "Special Permissions"


Click OK once and then click OK one more time to get back to Windows Explorer.
You should now be able to delete the folder and files.
Following as best I could I could still not get away from the need special permissions message. I did go to the file and tried deleting each individual entry and they did go to the Rycycle bit but is that the best thing to do? Thanks:)
 

davehc

Microsoft MVP
Joined
Jul 20, 2009
Messages
1,957
Reaction score
502
"Since I just changed ownership to Administrator, why am I looking to change permissions again and also, who is now the user?"

You are not looking for that, you are reasserting the ownership. Was the "Administrator", or your choice, in fact there? If not, then, as in my post, put it in.

" I notice the administrator on the list does not allow for "Special Permissions""

Not essential for your problem.

But, if you followed through to the end, and you now apply "Take ownership" , it should work for the whole folder.
 
Joined
Mar 25, 2010
Messages
150
Reaction score
2
OK, ran through it all again and again, then clicked on the Take Ownership. Black screen came up and ran thru its thing. Clicked OK and back to Explorer. Back to Windows on EHD, clicked Delete. It started but again need permissions.

I guess I am missing something but thank you for helping me. Think I should try the indivicual item delete?:)
 

davehc

Microsoft MVP
Joined
Jul 20, 2009
Messages
1,957
Reaction score
502
Yes, if it is not too awesome! A couple of suggestions, choose the shortest route.
How about trying to copy the whole folder over to your new hard disk and try the delete option again? or
Copy anything you do need over to your hard disk and reformat the external.
 
Joined
Mar 25, 2010
Messages
150
Reaction score
2
Thanks again. I tried to move the folder over to my computer hd but again not without permissions. I then took chunks of the code and items in the Windows folder and deleted them. At first it said I need permissions, then Continue which I did and I was able to delete the entire contents of the file except System 32.

I will just keep it until I can clear that external hard disk and then reformat.
Thanks for all the advicd.
 

TrainableMan

^ The World's First ^
Moderator
Joined
May 10, 2010
Messages
9,361
Reaction score
1,587
Something else you may want to try from an elevated DOS prompt ...

Go to Start Menu\All Programs\Accessories
You should see Command Prompt in the list
Right-Click on Command Prompt and pick "Run As Administrator"

Now what drive letter is this extra drive? Lets say for example it is D:
So type "D:" (no quotes, substituting the drive letter of your external HD) and hit enter

And you said the folder is Windows (and then System32 is down under that)
So type "CD \Windows" (no quotes, a space after CD)

Now it should show you at D:\Windows

Now type "attrib -r -s -h /s" (no quotes, space before all 4 parameters, notice the "/s" has a forward slash not a backward slash like for directories) and hit enter

Now you can close the window.

Try to delete.

****************
If THAT doesn't work then my next suggestion is to download and install a program called Unlocker which is in the File & Folder section of our Freeware DB

Then you go into Windows Explorer, find the external HD folder, right-click, select unlocker, choose action DELETE
 
Last edited:
Joined
Mar 25, 2010
Messages
150
Reaction score
2
Hi, Ok, I don't see Command Prompt on Accessories or other lists there. I typed in Command Prompt in search box and I got a black DOS screen. Tried to put in F my external hard drive, but it would not recognize it.

I then went to suggestion 2, downloaded Unlocker and after a little fiddling it worked!!!
Thank you for helping me, it is much appreciated!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top