Search This Blog

Wednesday, August 22, 2007

Taking Ownership in Vista

Ever happen to find some of the files you cannot access (not because of ANSI or unicode)? That's because there are information embedded in the NTFS format. This is especially true if you copy over your files from your WinXP because the upgrade to Vista.

Sure, you can access them as Administrator mode, but you do not want to click ok several timesfor each file. Even worse, you will find that you cannot even save bookmark if you copied your favorites directory over.

Microsoft has anticipated this and has provided a tool know as takeown. To verify you have this problem, right click the file and look at security tab. You should see that there is a unknown owner who has some strange number (that was you on the other OS). Anyway, you can manually change this for EACH of the file or you can use takeown.

The format is as such :

TAKEOWN [/S system [/U username [/P [password]]]] /F filename [/A] [/R [/D prompt]]

This tool allows an administrator to recover access to a file that was denied by re-assigning file ownership.

Parameter List:
/S system Specifies the remote system to connect to.

/U [domain\]user Specifies the user context under which the command should execute.

/P [password] Specifies the password for the given user context. Prompts for input if omitted.

/F filename Specifies the filename or directory name pattern. Wildcard "*" can be used to specify the pattern. Allows sharename\filename.

/A Gives ownership to the administrators group instead of the current user.

/R Recurse: instructs tool to operate on files in specified directory and all subdirectories.

/D prompt Default answer used when the current user does not have the "list folder" permissio
on a directory. This occurs while operat recursively (/R) on sub-directories. Vali
values "Y" to take ownership or "N" to sk

/? Displays this help message.

1) If /A is not specified, file ownership will be given to the current logged on user.

2) Mixed patterns using "?" and "*" are not supported.

3) /D is used to suppress the confirmation prompt.

TAKEOWN /F lostfile
TAKEOWN /F \\system\share\lostfile /A
TAKEOWN /F directory /R /D N
TAKEOWN /F directory /R /A
TAKEOWN /F C:\Windows\System32\acme.exe
TAKEOWN /F %windir%\*.txt
TAKEOWN /S system /F MyShare\Acme*.doc
TAKEOWN /S system /U user /F MyShare\foo.dll
TAKEOWN /S system /U domain\user /P password /F share\filename
TAKEOWN /S system /U user /P password /F Doc\Report.doc /A
TAKEOWN /S system /U user /P password /F Myshare\*
TAKEOWN /S system /U user /P password /F Home\Logon /R
TAKEOWN /S system /U user /P password /F Myshare\directory /R /A

As you can see the simplist way is to run takeown /f * /r to assign all files and sub folders in this directory to you. Well, if you find errors, start your command prompt in administrator mode and access the user id in takeown.

No comments:

Amazon Gift Cards!

Thanks for viewing!

Copyright © 2008, All rights reserved.