Hi all
I have a script I need to modify but I am not a powershell master of any kind so am unsure what I need to do, or what will work.
Basically, the business wanted to change all calendar permissions to "reviewer" for the user "default". I did this by exporting users in one OU at a time to a text file and then applying the script to that list of users, like this:
Get-content C:\Calendar.txt | ForEach-Object {Set-MailboxFolderPermission $_":\Calendar" -User Default -AccessRights Reviewer}
Now we have an issue that I am trying to provide a work around for until the issue is resolved and that means running this script on our Users OU every week, via a scheduled task. My thinking is I need to replace the "Get-content C:\Calendar.txt" bit with a command that will get all users in a given OU and then pipe that through to the ForEach command.
Anyone able to help me construct this script? Thanks in advance
EDIT: I guess I could run a 2 step scheduled task. Export all users in the OU to a text file as step one and then run this script as step 2. That would capture any new users created within the last week. Just wondering if there is a more elegant, on-the-fly way of doing it.
I have a script I need to modify but I am not a powershell master of any kind so am unsure what I need to do, or what will work.
Basically, the business wanted to change all calendar permissions to "reviewer" for the user "default". I did this by exporting users in one OU at a time to a text file and then applying the script to that list of users, like this:
Get-content C:\Calendar.txt | ForEach-Object {Set-MailboxFolderPermission $_":\Calendar" -User Default -AccessRights Reviewer}
Now we have an issue that I am trying to provide a work around for until the issue is resolved and that means running this script on our Users OU every week, via a scheduled task. My thinking is I need to replace the "Get-content C:\Calendar.txt" bit with a command that will get all users in a given OU and then pipe that through to the ForEach command.
Anyone able to help me construct this script? Thanks in advance

EDIT: I guess I could run a 2 step scheduled task. Export all users in the OU to a text file as step one and then run this script as step 2. That would capture any new users created within the last week. Just wondering if there is a more elegant, on-the-fly way of doing it.
Last edited: