Trouble modifying Folder rights

I am working on a script to create new users in our domain.  One of the steps 
is to create a home directory.  What I want to accomplish is create the 
folder. Turn off inheritance from the parent object, and add the the 
individual rules that are necessary.

So far I can create the folder and get the current acl but it does not seem 
to be getting modified.  here is my code so far.

New-Item "\\***********\test2" -type directory

$strFolder = "\\***********\test2"
$ACL = Get-Acl $strFolder
$identity = "Domain\admjsampson"
$rights = "modify"
#$Inheritance = @("ObjectInherit", "ContainerInherit")
$Inheritance = "ContainerInherit"
$Propagation = "None"
$Type = "Allow"
$Rule = New-Object 
system.security.accesscontrol.filesystemaccessrule($identity,$rights, 
$inheritance, $propagation, $type)
$ACL.SetAccessRuleProtection("$True","$False")
$ACL.resetaccessrule($Rule)

Any help would be appreciated.
0
Utf
3/5/2010 5:10:01 PM
windows.powershell 690 articles. 0 followers. Follow

1 Replies
837 Views

Similar Articles

[PageSpeed] 4

Jacob Sampson wrote:
> I am working on a script to create new users in our domain.  One of the steps 
> is to create a home directory.  What I want to accomplish is create the 
> folder. Turn off inheritance from the parent object, and add the the 
> individual rules that are necessary.
> 
> So far I can create the folder and get the current acl but it does not seem 
> to be getting modified.  here is my code so far.
> 
> New-Item "\\***********\test2" -type directory
> 
> $strFolder = "\\***********\test2"
> $ACL = Get-Acl $strFolder
> $identity = "Domain\admjsampson"
> $rights = "modify"
> #$Inheritance = @("ObjectInherit", "ContainerInherit")
> $Inheritance = "ContainerInherit"
> $Propagation = "None"
> $Type = "Allow"
> $Rule = New-Object 
> system.security.accesscontrol.filesystemaccessrule($identity,$rights, 
> $inheritance, $propagation, $type)
> $ACL.SetAccessRuleProtection("$True","$False")
> $ACL.resetaccessrule($Rule)
> 
> Any help would be appreciated.

Hi Jacob,

You're on the right lines with this, the step you've missed is applying 
the new ACL. All of the changes you've done so far effect the ACL you've 
loaded into memory.

So...

Set-ACL $strFolder -AclObject $ACL

One additional right you might want to add is Synchronize:

$rights = "modify", "Synchronize"

That'll change this from a "Special" permission to the Modify tick box 
in the main / basic permissions page.

HTH

Chris
0
Chris
3/5/2010 7:59:48 PM
Reply:

Similar Artilces:

Disable/Hide Public Folder at OWA
Hi, I am running Win2003 with Exchange 2003 w/SP1 - FE/BE. I need to have a user which only uses OWA for email and can't access any other thing like public folders. Is there any way to disable the "public folder" at OWA - not even display as an option for this user only. Thanks in advance. Kelvin You can use the OWA Administration tool to customize Outlook Web Access. It is available freely in the "All Exchange Tools" pack (the latest one updated along with SP1) -- Benoit Boudeville [Exchange MVP 2003-2004] "Kelvin" wrote: > Hi, > > I ...

Is there a way to display Public Folders in the All Mail Folders view? Outlook2003
We are getting ready to deploy Outlook 2003 to about 10,000 users. The powers that be do not want the users to have to click on the folder icon in order to see Public Folders (PF). They want them to be in their face when the software is first deployed. A new installation shows, on the left side of the window, Favorite Folders, All Mail Folders (which is the user's mailbox and folders that are on the Exchange server), large icons for Mail, Calendar, Contacts, and Tasks, small icons for Notes, Folder View, and Shortcuts. Then there's the little double arrow to configure all of the icons...

Favorite Folders
How do I get rid of the "favorite folders" on the top left of my screen with Outlook 2003? thanks, Ron You can't. You can however remove all entries by rightclicking them and choose Remove from Favorites Folders or Change to the Folder List Navigation -- Roady [MVP] www.sparnaaij.net Microsoft Office and Microsoft Office related News Also Outlook FAQ, How To's, Downloads and more... Tip of the month: -Tips for cleaning up your mailbox Subscribe to the newsletter to receive news and tips & tricks in your mailbox! www.sparnaaij.net (I changed my reply address; remov...

Folder Permissions & 2007
We have a share drive that contains multiple folders with individual spreadsheets that each user maintains. We have set up these folders with protection so users can’t delete the spreadsheets, copy others or modify the contents, only save/edit what already exists. A group was created with the users as members, permissions were granted to “Allow” all permissions except “Delete Subfolders & File” and “Delete”, and these are marked as “Deny”. Since there are multiple folders, they all inherit permissions from the main folder. In Excel 2003, the users are able to save as neede...

this file extinsion appear .xls~RF16b309.TMP in the same folder
this file extinsion appear .xls~RF16b309.TMP in the same folder where i save my file.xls I believe that is a history file, where you track changes made. In your workbook you probably have track changes set. -- The Code Cage Team Regards, The Code Cage Team 'The Code Cage' (http://www.thecodecage.com) ------------------------------------------------------------------------ The Code Cage Team's Profile: http://www.thecodecage.com/forumz/member.php?userid=2 View this thread: http://www.thecodecage.com/forumz/showthread.php?t=33675 I would look at the antivirus program that yo...

How to trap Mouse right button click on PushButton in VC++
I want to display a popup menu if the mouse is right clicked on the PushButton. In other words, how to trap right click action on Pushbutton in VC++??? "neel" <neel@discussions.microsoft.com> wrote in message news:DCE3C043-A4FB-49D8-ADCF-EAB1EA682004@microsoft.com... >I want to display a popup menu if the mouse is right clicked on the > PushButton. In other words, how to trap right click action on Pushbutton > in > VC++??? WM_RIGHTCLICK is sent to the button, so you have to intercept messages to the button. You derive a class from CButton, and you add a co...

Inbound emails get stuck in the Queue (folder)
hello i was wondering if anyone had encountered this problem. when we rebooted our server, the inbox seemed to fill up with 60,000 emails dating back months. upon investigation, it was found that these messages were "stuck" in the queue folder, and the reboot forced them out in to the inbox. i have found newsgroup entries that say about outbound messages being stuck but none about inbound messages. after a few more reboots, (to solve other problems!!), the queue does not seem to be growing anymore. it seems to have fixed itself! but does anyone have any ideas why this happened...

Left() or Right()
Hi, I have a list of postcodes (zip codes) that I need to 'extract' part of and allocate to a new cell. eg: AL1 2TQ AL1 5RD AL22 9IP I need to take the first characters before the space however it could be 3 or 4 characters before each space. I need a formula that will start from the left and take anything before a space or one that starts from the right and takes anything before the righthand 3 characters and the space. I've tried left and right but can't quite get it to work. Any ideas? Thanks in advance. -- giantwolf ----------------------------------------------...

Public Folder w/subfolders.. I can't see'em
I have a new win2003 server/exchange2003 using the outlook2003 client that I have so far migrated over fairly good so far from exchange 5.5. I have some public folders that have subfolders, and as a user they can't see any of their subfolders in outlook2003, however as a administrator I can see them fine in outlook. When I look in the permissions tab of the subfolders they all have reviewer permissions, is there somewhere else that I need to add permissions in order for them to see the subfolders (perhaps in the exchange server)? Do they have the "folder visible" per...

Public folders #4
Is there anyway to display notifactions when there is a new message in public folders?? Not exactly. But if you go into the properties of the public folder you can use the Folder Assistant to forward new messages to you. -- Aloha, -Ben- Ben M. Schorr, OneNote-MVP http://home.hawaii.rr.com/schorr **I apologize but I am unable to respond to direct requests for assistance. Please post questions and replies here in the newsgroup. Mahalo! <anonymous@discussions.microsoft.com> wrote in message news:018001c3a93b$d340cdb0$a101280a@phx.gbl... > Is there anyway to display notifaction...

Move mailbox rights in Exchange 5.5
What is the most restrictive set of rights that would allow an administrator to move mailboxes between 2 servers in the same site? Providing the administrator an admin role on the Servers container, on each server, or on the Private/Public Information Store gives him undesired privileges (like changing default storage limits). Thanks in advance for any assistance. ...

Contacts folder could not be displayed
Here's what I do to re-create the error. I create a new message, then click on the 'To:' button. Then this error pops up. 'The address list could not be displayed. The Contacts folder associated with this address list could not be opened; it may have been moved or deleted, or you do not have permissions. For information on how to remove this folder from the Outlook Address Book, see Microsoft Office Outlook Help.' However, the contacts are present in my contact address book. It's just I cannot select them from the "To" button. I've tried the h...

multiple personal and archive folders
Somehow I have come up with multiple Personal Folders (2) and both seem to be active since I can't close or rename either. The archive folders point to different locations and I can close or rename either. How did I manage to do this and how can I simplify it? Thanks. I've got exactly the same problem, went to the microsoft site ....http://office.microsoft.com/en-us/assistance/HA011170471033.aspx but proved to be useless. They didn't even have links to where our problem could be dealt with I generally find that i have more luck by googling 9 times out of 10. Like you b...

Import Data: on insert, shift data down and not right
Hi, I'm importing data from an external source (notes database). The data is being put in between different rows which have existing data. The problem I'm stuck with is that on the insert of the data, I would like an existing data to moved downwards but instead it's being moved to the right. I.e. the colums are shifting right whereas I would like the rows to be moved down. Can anyone please help with this. Thanks Lena It's not clear how you're doing this "insert" of data. Importing data typically brings it in as a block, either in a new workbook or in a...

How are folders organized in Outlook?
Hello, how are folders organized in Outlook? Is there a MainFolder which keeps all the other folders and so on? Or are the basically different kind of folders? For mail, contacts? (I don't think so but Im not sure) Is there already something implemented which shows me a list of all folders, maybe similar to the folder in the windows explorer itself. And how does outlook identify the folders? Is there an internal unique value? Thanks in advance, Mat. ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages dire...

Duplicate Folders on Drop down menu
How do I delete duplicate entries that I created in the drop down folder listings of the move message to box ...

How do I sort the folders list in Outlook 2002?
I want my Personal folders under my Outlook Today, but they are flipped in the folders list view. Does anyone know how to fix this? Thanks, Jeff Click (highlight) the folder you want (press left mouse button and hold) then drag/move it where ya want it. >-----Original Message----- >I want my Personal folders under my Outlook Today, but >they are flipped in the folders list view. Does anyone >know how to fix this? > >Thanks, >Jeff >. > >I want my Personal folders under my Outlook Today, but >they are flipped in the folders list view. Folders are pres...

public folder problem
in exchange 2000 i have create a public folder ,and we have put inside the public folder one excel file . everytime that the user open the file to update it with new data ,after he save and closing the file the new data are not in the file .and it keeps a copy of the file in a temporary place in his pc with the new data . the user has win2000 os and outlook 2000 . did any one knows the problem and can give me a help ? Does the user have Write access on the public folder? Try having the user close Excel completely after closing and saving the file. -- Sue Mosher, Outlook MVP Autho...

Twin Personal Folders
In the Folders List in Outlook 2003, I have a twin Personal Folders showing. The second is ide ntical with the first (including all sub-folders) and anything I do in Outlook is mirrored in both! I checked everything I could think of in Data Files and Options, but cannot set this right. There is only one Personal Folders listed in Data Files anyway! It does not hamper operations at all but is just a bit disconcerting. This suddenly came up from a few days ago - earlier I could see only one Personal Folders with all sub-folders listed under it. Any insight would be much appreciated. Re...

OUTLOOK 2002 folders
I had to reinstall everything on my computer, my personal mail folders were stored on a separate drive (*.dbx file). How can I get those back in my outlook mail box?? Outlook works with pst-file. Outlook Express works with dbx-files For Outlook; To access your pst-file; File-> Open-> Outlook Data File... To set it as the default delivery location; Tools-> E-mail Accounts...-> button Next-> use the dropdownlist below For OE ask in an OE newsgroup; Here is the link for the right forum http://communities.microsoft.com/newsgroups/default.asp?icp=InternetExplorer Good Luck! -...

Basic questions about Personal vs. Offline folders
I've done some reading and research but cannot seem to find a concise solution to my dilema. I use a Microsoft Exchange server for Outlook. 1. I would like to be able to read my mail offline when I don't have access to the server 2. I would also like to be able to limit the amount of mail on the server. >From what I have read, Offline folders would be a good solution for #1 but not for #2, because offline folders need to be sync'ed with the server from time to time. Personal folders sound like a solution to #2 but not to #1. Am I misinformed? Is there a solution that will sat...

Modifying GetRootItem()
Hello, Is there a way to modify GetRootItem() function so it treats a particular directory as root? So far GetRootItem() always goes to "/" and if I want users to go to a different directory say, a/b/c, it first finds and expands a, then same for b and finally does c. This is quite ineffieicent and I think its complexity is like O(something exponential). So, is there a way to modify GetRootItem() so it works O(1) on a specific directory? Thank you. Victor. Describe your problem a little better. GetRootItem returns the Root item of a tree control (that's if you are us...

Error message in Outlook: Inbox folder
Unable to display the folder. Error in the file C;\Windows\Local Setting\Application Data\Microsoft\Outlook\outlook.pst. I have reloaded Office XP and did the repair. The error message is still there, unable to receive email. Does anyone have a fix for this problem? Thanks, Michael What "repair" did you use -- Detect and Repair or the Inbox Repair Tool? -- Jocelyn Fiorello MVP - Outlook *** Messages sent to my e-mail address will NOT be answered -- please reply only to the newsgroup to preserve the message thread. *** In news:046a01c3ae3f$89391ca0$a301280a@phx.gbl, Mic...

Sign in trouble
I haven't used my Money program in at least a year. After restoring my backup file I was presented with a sign in box. I use an auto password program and couldn't find the needed Money password. I tried my MS Passport Network password but it didn't work. From "User Accounts" I changed my Passport password. I'm still receiving an error message from the Money sign in page and can't access the restored file. It states something like "The password is not associated with the Money file needed to view the restored files." Or something close to that....

Trouble downloading .ofx files from BofA
I have run into this problem more than once, and it appears to be somewhat random. I download my checking statements from Bank of America and there are two options for MS Money users: 1)Active Statement, and 2)QIF 4-digit files. I much prefer Active Statements as they contain more information and MS Money "remembers" what's been downloaded before. The trouble is, around January, I started getting the error message "The file you attempted to import contains invalid or corrupt data...if the problem persists, contact your financial institution" whenever I would ...