locked
List Get-MailboxFolderPermission (and export to a file) RRS feed

  • Question

  • Good Morning!

    I'm using the below script from this thread: http://social.technet.microsoft.com/Forums/en-US/exchangesvradmin/thread/d8ffef98-cd5f-4ce9-94cf-47cca32961b1/#7bd9aa52-1afd-490b-898c-dbd7aeca3a22 in Exchange 2010, however it throws the following error:

    The specified mailbox "@{Alias=USER}" doesn't exist.
    + CategoryInfo : NotSpecified: (0:Int32)
    [Get-MailboxFolderPermission], ManagementObjectNotFoundException
        + FullyQualifiedErrorId :
    DDDCC6C6,Microsoft.Exchange.Management.StoreTasks.GetMailboxFolderPermission

    It seems like instead of just picking the alias, it picks "alias=the alias" so it doesn't work correctly.

    Is there a fix for this? I had other notions of maybe using a CSV file with all the mailbox names under a heading called displayName but thinking through it is a bit much for my amateur mind on Monday morning.

    Thanks in advance

    Paddy

    $AllUsers = get-mailbox * | select Alias
    
    ForEach ($User in $AllUsers) {
    
    $Mailbox = ""+ $User +":\Inbox" 
    
    $Text0 = "---"
    $Text1 = ""
    $Text2 = "AccessRights For Mailbox: "+ $User +""
    $Text3 = ""
    $Text4 = "---"
    $Text5 = ""
    
    $Text0 | Out-File c:\Inbox_Permissions.txt -append
    $Text1 | Out-File c:\Inbox_Permissions.txt -append
    $Text2 | Out-File c:\Inbox_Permissions.txt -append
    $Text3 | Out-File c:\Inbox_Permissions.txt -append
    $Text4 | Out-File c:\Inbox_Permissions.txt -append
    
    get-mailboxfolderpermission -identity $Mailbox | Select User, FolderName, AccessRights | Out-File c:\Inbox_Permissions.txt -append
    
    $Text5 | Out-File c:\Inbox_Permissions.txt -append
    
    }
    

    Monday, May 14, 2012 8:14 AM

Answers

  • Try this

    $mailbox = "" +$user.alias + "\inbox"


    Lets explain why
    $user is an object list based on get-mailbox, with only specific attributes
    So you had to address which attribute you wanted even dough it had only one included (but that could have been more too).


    • Proposed as answer by PGT2008 Monday, May 14, 2012 9:03 AM
    • Edited by PGT2008 Monday, May 14, 2012 9:05 AM typo
    • Marked as answer by Paddy Maxson Monday, May 14, 2012 9:59 AM
    Monday, May 14, 2012 9:03 AM

All replies

  • Try this

    $mailbox = "" +$user.alias + "\inbox"


    Lets explain why
    $user is an object list based on get-mailbox, with only specific attributes
    So you had to address which attribute you wanted even dough it had only one included (but that could have been more too).


    • Proposed as answer by PGT2008 Monday, May 14, 2012 9:03 AM
    • Edited by PGT2008 Monday, May 14, 2012 9:05 AM typo
    • Marked as answer by Paddy Maxson Monday, May 14, 2012 9:59 AM
    Monday, May 14, 2012 9:03 AM
  • Not only does it work now, but I greatly appreciate that you explained it to me!

    Thank you.

    Monday, May 14, 2012 9:59 AM
  • If with the change this script does not work for me and I get the following error condition, can anybody help its really urgent?

    The specified mailbox "JoKeller\inbox" doesn't exist.
        + CategoryInfo          : NotSpecified: (0:Int32) [Get-MailboxFolderPermission], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : 61B39A5A,Microsoft.Exchange.Management.StoreTasks.GetMailboxFolderPermission

    • Proposed as answer by leslie hill Monday, August 13, 2012 11:36 AM
    Saturday, June 30, 2012 5:39 PM