Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Remove all NTFS Permissions from Folder

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 03-12-2008   #1 (permalink)
Gregor
Guest


 

Remove all NTFS Permissions from Folder

Hello

I would like remove NTFS permission form folder

My folder have the standard

Administrators
Creator owner
System
Users (Host\Users)

How delete all items and how delete the item Users?

My experiment:

$directory = "c:\data"
$acl = get-acl $directory
$account = new-object system.security.principal.ntaccount("Users")
$acl.purgeaccessrules($account)
set-acl -aclobject $acl -path $directory

this is missing...

How you have a idea?

thanks
Gregor



My System SpecsSystem Spec
Old 03-12-2008   #2 (permalink)
Shay Levi
Guest


 

Re: Remove all NTFS Permissions from Folder


Removing domain groups works fine however local groups does not get effected.
I found that if you remove the "inherit from parent" flag (gui) then the
code runs fine and the group is removed.


-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Quote:

> Hello
>
> I would like remove NTFS permission form folder
>
> My folder have the standard
>
> Administrators
> Creator owner
> System
> Users (Host\Users)
> How delete all items and how delete the item Users?
>
> My experiment:
>
> $directory = "c:\data"
> $acl = get-acl $directory
> $account = new-object system.security.principal.ntaccount("Users")
> $acl.purgeaccessrules($account)
> set-acl -aclobject $acl -path $directory
> this is missing...
>
> How you have a idea?
>
> thanks
> Gregor

My System SpecsSystem Spec
Old 03-13-2008   #3 (permalink)
Desmond Lee
Guest


 

RE: Remove all NTFS Permissions from Folder

How about using the built-in cacls.exe utility to do the same for
top_of_folder and all sub-folders:

cacls top_of_folder /c /t /e /r users

Not strictly a POSH solution but can be called within a .ps1 script or run
from POSH console.

HTH.

--
http://www.leedesmond.com/weblog/



"Gregor" wrote:
Quote:

> Hello
>
> I would like remove NTFS permission form folder
>
> My folder have the standard
>
> Administrators
> Creator owner
> System
> Users (Host\Users)
>
> How delete all items and how delete the item Users?
>
> My experiment:
>
> $directory = "c:\data"
> $acl = get-acl $directory
> $account = new-object system.security.principal.ntaccount("Users")
> $acl.purgeaccessrules($account)
> set-acl -aclobject $acl -path $directory
>
> this is missing...
>
> How you have a idea?
>
> thanks
> Gregor
>
>
My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to list out ntfs permissions Frank PowerShell 3 11-16-2007 09:30 AM
Copy NTFS permissions BMC PowerShell 1 08-01-2007 02:02 PM
NTFS Permissions on System Folders in Vista Todd Bowlsby Vista General 7 07-11-2007 11:32 PM
NTFS permissions for a domain user RedParanoid Vista networking & sharing 0 04-28-2007 02:04 AM
NTFS Security Permissions (HOW TO RESET?) Mike (Bryett Enterprise LTD) Vista security 4 06-14-2006 12:54 PM


Update your Vista Drivers Update Your Drivers Now!!

Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008