[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Report on Shared Calendar permissions

Posted on 2013-06-10
6
Medium Priority
?
984 Views
Last Modified: 2016-11-29
I am trying to figure out how can i make this powershell command also include the actual identity of the users calendar

(Get-Mailbox -ResultSize unlimited) | foreach {
      $alias = $_.alias;
      $User = $_.User
    $FolderName = $_.FolderName
    $AccessRights = $_.AccessRights
      Get-MailboxFolderPermission "$($alias):\calendar" | ? { $_.user -like "Default"} | select @{n="Alias";e={$alias}},@{n="User";e={$User}},@{n="FolderName";e={$FolderName}}@{n="AccessRights";Expression={[string]::join(', ', $_.AccessRights)}}
}

The powershell script does get all the needed values expect the actual users mailbox that am trying to see who has what access.

I should get an output as follows the actual Users mailbox (Alias), the FolderName and the access rights the user has for those folder names. I get everything expect Alias as an output.

Thanks
0
Comment
Question by:adokilla
  • 3
  • 2
6 Comments
 
LVL 43

Expert Comment

by:Adam Brown
ID: 39236256
Alias isn't a variable that is returned by the get-mailboxfolderpermissions cmdlet. Your select is pulling data from that cmdlet only, so Alias won't be an object that is discovered by it, and as a result it won't output anything for Alias. You could replace alias with identity in your select and you'll get some identifying information, but it will probably not be what you want. The real solution would be to create a new PSObject and package variables into it. Like this:

(Get-Mailbox -ResultSize unlimited) | foreach {
      $alias = $_.alias;
      $User = $_.User
#create object
      $output = new-object -typename psobject
#add alias to new object
      $output | Add-Member –MemberType NoteProperty –Name Alias –Value $alias
#get permission info
      $perms = Get-MailboxFolderPermission $alias":\calendar" | ? { $_.user -like "Default"} | select  accessrights,foldername,user
#add permission info to object
      $output | Add-Member -MemberType NoteProperty -Name User -value $perms.user
      $output | Add-Member -MemberType NoteProperty -Name FolderName -value $perms.foldername
      $output | Add-Member -MemberType NoteProperty -Name AccessRights -value $perms.AccessRights
#output the data
      $output | fl}
      

Open in new window

0
 

Author Comment

by:adokilla
ID: 39237784
How do i export this to a csv ? and make it readable as i tried using Export-Csv but its all numbers that gets exported nothing is readable.

Thanks
0
 
LVL 43

Accepted Solution

by:
Adam Brown earned 360 total points
ID: 39239320
replace the fl at the end with
export-csv c:\file.csv -append

Make sure c:\file.csv doesn't exist. If you put the export after fl it will break.
0
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

 

Author Comment

by:adokilla
ID: 39296952
Thanks that worked.
0
 

Author Closing Comment

by:adokilla
ID: 39296955
Thanks that worked.
0
 

Expert Comment

by:Rob Wilderman
ID: 41905827
I keep getting this:

Export-Csv : A parameter cannot be found that matches parameter name 'append'.
At C:\users\rwilderman\CalendarPermissionsReport.ps1:15 char:79
0

Featured Post

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
Transferring FSMO roles is done when an admin wants to split roles between certain Domain Controllers or the Domain Controller holding the Roles has been forcefully demoted using dcpromo / forceremoval
how to add IIS SMTP to handle application/Scanner relays into office 365.
Simple Linear Regression
Suggested Courses

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question