Add the Everyone group to the directory and all its subdirectories

I am currently using the 32-bit version of Vista. How to add the Windows security group "Everyone" and give full control over the directory and all its subdirectories and all files? Can i use powershell script?

Thanks!

+7
source share
3 answers

I expanded the martina fragment and was able to provide access to all folders and subfolders. Here is my code -

$FilesAndFolders = gci "c:\data" -recurse | % {$_.FullName} foreach($FileAndFolder in $FilesAndFolders) { #using get-item instead because some of the folders have '[' or ']' character and Powershell throws exception trying to do a get-acl or set-acl on them. $item = gi -literalpath $FileAndFolder $acl = $item.GetAccessControl() $permission = "Everyone","FullControl","Allow" $rule = New-Object System.Security.AccessControl.FileSystemAccessRule $permission $acl.SetAccessRule($rule) $item.SetAccessControl($acl) } 
+8
source
 $acl = Get-Acl c:\mydir $permission = "Everyone","FullControl","Allow" $rule = New-Object System.Security.AccessControl.FileSystemAccessRule $permission $acl.SetAccessRule($rule) $acl | Set-Acl c:\mydir 
+4
source

Sometimes the native way of PowerShell is not always the best way. For something like this, I will still use icacls.exe. Remember that good experience is very good at PowerShell. Just cd to the directory you want to install and execute:

 icacls $pwd /grant "Everyone":(OI)(CI)F 

This will give Everyone full access to the current directory down (through permission inheritance). This should work as long as there are no explicit failures for everyone in the dir structure.

+3
source

All Articles