Margarita
asked on
Need help with mailbox permissions script
Hi all,
I need help editing this script;.
There is a statement which allows me to import a CSV but it always chooses to get all mailboxes.
Please help x
I need help editing this script;.
There is a statement which allows me to import a CSV but it always chooses to get all mailboxes.
Please help x
Which script might that be?
ASKER
Looking at the code, the script will always look for the "C:\temp\test.csv" file, regardless of what value you provide for the $userIDFile parameter.
ASKER
But I have assigned a list of users which I wanted to check what permissions they have to which mailboxes and it didn't go through the list
It just checked the permissions of all shared mailboxes
It just checked the permissions of all shared mailboxes
Change this line
to this
Then pass the path to the CSV file in the userIDFile parameter.
$objUsers = Import-Csv "C:\temp\test.csv" -Header "UserPrincipalName" $UserIDFile
to this
$objUsers = Import-Csv $userIDFile -Header "UserPrincipalName"
Then pass the path to the CSV file in the userIDFile parameter.
ASKER
#Check if we have been passed an input file path
if ($userIDFile -ne "")
{
#We have an input file, read it into memory
$objUsers = Import-Csv $userIDFile -Header "UserPrincipalName"
}
else
{
#No input file found, gather all mailboxes from Office 365
$objUsers =Get-Mailbox -Filter {RecipientTypeDetails -eq "SharedMailbox"} -ResultSize Unlimited | select UserPrincipalName
}
Again is going through the shared mailboxes.
How am I going to declare the list via CSV?
if ($userIDFile -ne "")
{
#We have an input file, read it into memory
$objUsers = Import-Csv $userIDFile -Header "UserPrincipalName"
}
else
{
#No input file found, gather all mailboxes from Office 365
$objUsers =Get-Mailbox -Filter {RecipientTypeDetails -eq "SharedMailbox"} -ResultSize Unlimited | select UserPrincipalName
}
Again is going through the shared mailboxes.
How am I going to declare the list via CSV?
How are you running the script?
ASKER
Through powershell ISE
Which ever way I run it it doesn't work.
Which ever way I run it it doesn't work.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I did try it like that but I will try again now and I will let you know
ASKER
Vasil both of these worked.
Thank you so much for your help! X X X
Thank you so much for your help! X X X
ASKER
Vasil thank you for your help.
your comments helped me through and made it work for me
Greatly appreciated the time you spent!
your comments helped me through and made it work for me
Greatly appreciated the time you spent!