I wanted to automate the process of pushing this checkbox for all users who has a “OutlookArchive” Folder.
The unforeseen error on my part was this: I had the quest tool create all the archives on \\server\home\myadmin folder, then i used a PowerShell move command to move the files to each users home folder.
Because I moved the file, it was really fast, but it retained the original permissions from the source folder (hence, exadmin had rights to it, but not the user)
If I would have copied the file rather than moving the file, everything would have been ok, because coping the file makes a new file and the new file inherits the permissions of the parent folder (OutlookArchive), but it would have taken much longer to copy than to move.
That is why that person could not access their migrated.pst file due to permissions issue.
So, I want to automate this red box for all users with an OutlookArchive Folder and a Migrated.pst file in it.
To fix this, I made a batch file and used the free tool SETACL to reset the above inhermited permissions.
The batch file code:
For /F “tokens=*” %%I IN (%_InputFile%) DO (
IF EXIST \\server\home\%%I\OutlookArchive\Migrated.pst (
SetACL.exe -silent -on “\\server\home\%%I\OutlookArchive*” -ot file -actn setprot -op “dacl:np;sacl:np” -rec cont_obj -actn setowner -ownr “n:S-1-5-32-544;s:y” -actn clear -clr “dacl,sacl”
rem ELSE (
I created the alluses.txt from doing a dir at the \\server\home folder and piping it to a text file, then I used excel to clean up the file, so I had a listing of all the uses home folders.
The line “IF EXIST” checks to see if the file migrated.pst exists in each home folder, if it does, it runs the next line, which is the setacl command to do the same thing as the Red box in the graphic. (Thank you google)