Forum Discussion
Freshie
Jul 11, 2024Copper Contributor
Help using a file for input
Hello everybody, I am currently using this script to automate a process, the problem, is it only processes one user at a time. Add-MailboxPermission -Identity "USERNAME" -User "sa_sourceone" -Acc...
LainRobertson
Jul 11, 2024Silver Contributor
Hi, Jeff.
Assuming your input file has one username per line, like this:
You can use the following command line to perform the Add-MailboxPermission for each user:
Get-Content -Path "D:\Data\Temp\Forum\forum.txt" | ForEach-Object {
Add-MailboxPermission -Identity "$_" -User "sa_sourceone" -AccessRights FullAccess -InheritanceType All -AutoMapping $false;
}
Cheers,
Lain