Hello, I’m a very basic PS user. I just started teaching it to myself last year. The script below is supposed to add the user to every folder below Inbox\Case Files and make them the owner. I built it last year after searching online for days for help. I already gave them FolderVisible access to the Inbox and Case Files. I used this last year and it worked. Now when I try to run it on a new hire, it doesn’t do anything. And when I turned on Verbose, it looks like it tries to run but doesn’t actually change anything. I can provide that if someone wants to see it. I’ve removed the domain below but otherwise the script is intact. Can someone please take a look and tell me where it’s going wrong?
Formatting your script as code on the forum is pretty much a requirement for peer review. Since you still haven’t edited your original post to format the code I decided to do it so I could read it:
And then I was able to see an issue. On line 8 after you pipe Ge-tEXOMailboxFolderStatistics to Where-Object there’s a missing underscore on the automatic variable for “Current object”.
This:
This would cause the Where-Object statement to return nothing, and so the Foreach-Object loop afterwards would not iterate through anything.
And again on line 10, a missing underscore:
$fname = "jjo:" + $.FolderPath.Replace("/","")
These two loops are trying to accomplish the same action right? It looks like two different ways of applying the permissions. This was ran as a script?