Tom's Hardware > Forum > Windows XP > Windows XP General Discussion > take ownership of a file/folder using a script

take ownership of a file/folder using a script

Forum Windows XP : Windows XP General Discussion - take ownership of a file/folder using a script

Tom's Hardware: Over 1.4 million members in 6 different countries available to answer all your high-tech questions. Sign up now! Its free!
Word :    Username :           
 

Archived from groups: microsoft.public.windowsxp.security_admin (More info?)

 

Hello,

Does anyone know how to take ownership of a file using a script?
Or any tools that a script/program could invoke to do this?

Thanks

Sponsored Links
Register or log in to remove.

Archived from groups: microsoft.public.windowsxp.security_admin (More info?)

 

While it doesn't appear to confer "ownership", CACLS can be used to assign Full Control to files and folders. Open a Command Prompt window and enter CACLS /?

--
Doug Knox, MS-MVP Windows Media Center\Windows Powered Smart Display\Security
Win 95/98/Me/XP Tweaks and Fixes
http://www.dougknox.com
--------------------------------
Per user Group Policy Restrictions for XP Home and XP Pro
http://www.dougknox.com/xp/utils/x [...] onsole.htm
--------------------------------
Please reply only to the newsgroup so all may benefit.
Unsolicited e-mail is not answered.

"D" <D@discussions.microsoft.com> wrote in message news:11468782-4793-4FDF-ACBE-5DFC39AD9D47@microsoft.com...
> Hello,
>
> Does anyone know how to take ownership of a file using a script?
> Or any tools that a script/program could invoke to do this?
>
> Thanks
>

Reply to Anonymous
- 0 +

Archived from groups: microsoft.public.windowsxp.security_admin (More info?)

 

Hi Doug,

Thanks for the info. I havr already tried using xcacls and cacls but I get
"Access is denied". Maybe i'm doing something wrong?

More info follows:
I have some users on a machine, and I want to delete some of their profile
directories, e.g E:\Users\User1\profile

In explorer, if I try and view the folder, I get "Access denied". However I
can
take ownership via the security tab in explorer and get access that way. (When
I click the security tab, it says "you cannot view or edit permissions, but
you can
take ownership", and it seems to work ok.) However, I need to take ownership
via
script.

I've tried using the (X)CACLS commands such as (where sysadmin is the
adminstrator account):
CACLS E:\Users\User1\profile /P sysadmin F
XCACLS E:\Users\User1\profile /E /G sysadmin:F;O
XCACLS E:\Users\User1\profile /P sysadmin:F;O
XCACLS E:\Users\User1\profile /P sysadmin:;O

But each one just gives me the "access is denied" message.

Any thoughts about this?

thank you
David


"Doug Knox MS-MVP" wrote:

> While it doesn't appear to confer "ownership", CACLS can be used to assign Full Control to files and folders. Open a Command Prompt window and enter CACLS /?
>
> --
> Doug Knox, MS-MVP Windows Media Center\Windows Powered Smart Display\Security
> Win 95/98/Me/XP Tweaks and Fixes
> http://www.dougknox.com
> --------------------------------
> Per user Group Policy Restrictions for XP Home and XP Pro
> http://www.dougknox.com/xp/utils/x [...] onsole.htm
> --------------------------------
> Please reply only to the newsgroup so all may benefit.
> Unsolicited e-mail is not answered.
>
> "D" <D@discussions.microsoft.com> wrote in message news:11468782-4793-4FDF-ACBE-5DFC39AD9D47@microsoft.com...
> > Hello,
> >
> > Does anyone know how to take ownership of a file using a script?
> > Or any tools that a script/program could invoke to do this?
> >
> > Thanks
> >
>

Reply to d

Archived from groups: microsoft.public.windowsxp.security_admin (More info?)

 

D wrote:

> Hello,
>
> Does anyone know how to take ownership of a file using a script?
> Or any tools that a script/program could invoke to do this?
>
> Thanks
>
Hi

SubInACL looks like is able to do this:

subinacl /noverbose /file \\server\share\dir /setowner=whoever
subinacl /noverbose /subdirectories \\server\share\dir\* /setowner=whoever

New bug fixed version of SubInACL is available for download...
(Windows 2000, Windows Server 2003, Windows XP)

http://www.microsoft.com/downloads [...] 6985e3927b


--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/s [...] fault.mspx

Reply to Anonymous
- 0 +

Archived from groups: microsoft.public.windowsxp.security_admin (More info?)

 

Hello,

Thanks everyone for your help.
The tool SubInACL worked fantastically.
Thanks!

Regards,
David

"Torgeir Bakken (MVP)" wrote:

> D wrote:
>
> > Hello,
> >
> > Does anyone know how to take ownership of a file using a script?
> > Or any tools that a script/program could invoke to do this?
> >
> > Thanks
> >
> Hi
>
> SubInACL looks like is able to do this:
>
> subinacl /noverbose /file \\server\share\dir /setowner=whoever
> subinacl /noverbose /subdirectories \\server\share\dir\* /setowner=whoever
>
> New bug fixed version of SubInACL is available for download...
> (Windows 2000, Windows Server 2003, Windows XP)
>
> http://www.microsoft.com/downloads [...] 6985e3927b
>
>
> --
> torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of
> the 1328 page Scripting Guide:
> http://www.microsoft.com/technet/s [...] fault.mspx
>

Reply to d
Tom's Hardware > Forum > Windows XP > Windows XP General Discussion > take ownership of a file/folder using a script
Go to:

There are 1141 identified and unidentified users. To see the list of identified users, Click here.

Please mind

You are about to answer a thread that has been inactive for more than 6 months.
If you still wish to proceed, please ensure that your posting is original and does not duplicate or overlap any prior responses to this thread.

Add a reply Cancel
Sponsored links
  • Ask the community now
  • Publish
Ad
They won a badge
Join us in greeting them