Jump to content

Recommended Posts

Posted (edited)

Hi Guys,

 

I would like to change the default sharing policy for mailboxes (in office365) from input from a CSV file. This is because the default policy is not set automatically.(Can't wait for Microsoft to come with a solution). I wrote the following script to accomplish this goal.

 

$list = Import-Csv ".\names.csv"
foreach($entry in $list) {
$User = $entry.User
Get-Mailbox -Identity $User | Get-MailboxFolderStatistics | Where {$_.Foldertype -ilike "calendar"} | set-MailboxFolderPermission  -User Default -Accessrights limiteddetails } 

 

Error message:

The specified mailbox "test\Calendar" doesn't exist.

+ CategoryInfo : NotSpecified: ( : ) [set-MailboxFolderPermission], ManagementObjectNotFoundException

+ FullyQualifiedErrorId : [server=A*********,RequestId=4*****-9ded-4099-b**b-ab5eba451caa,TimeStamp=13-11-2014 22:33:30] [FailureCategory=Cmdlet-ManagementObjectNotFoundException]

510441E8,Microsoft.Exchange.Management.StoreTasks.SetMailboxFolderPermission

+ PSComputerName : pod*******h.outlook.com

 

It says that the calendar doesn't excist. this is because it should be "test:\calendar" and not "test\calendar"

 

The reason i put "Where {$_.Foldertype -ilike "calendar"} " in the script is bacause not all calendar folders are named the same.

 

My questions is how can i add the ":" in front of the calendar.

 

I'm pretty new to powershell so i hope this is an easy 1 for you guys:)

 

My csv looks like this:

 

user

test

test2

test3

 

Any Help appreciated!

 

Regards,

 

DJ

Edited by datajunkyxl
Posted

ok, i'm trying to reach my goal by exporting my first output to a csv. Can someone tell me why i only get 1 entry in the output csv while there's more in the input?

 

This is the code.

 

$list = Import-Csv ".\names.csv"

foreach ($entry in $list) {

$User = $entry.User

Get-Mailbox -Identity $user | Get-MailboxFolderStatistics | Where {$_.Foldertype -ilike "calendar"} | select identity | export-csv names2.csv }

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...