none
Exporting User Mailbox permissions to csv file RRS feed

  • Question

  • Looking for a script that export list of users that have their mailboxes shared to other users as well as being forwarded to other users.  Here is the script I am using to pull attributes needed for my export file.  The problem with my script is that it only pulls AD attributes and not Exchange attributes.  The ones it does not pull down are "msExchDelegateListLink" and "altRecipient".  Any help will be appreciated.

    get-qaduser -sizelimit 0 -searchroot

    "company/TestOU" | selectuseraccountcontrol,name,samaccountname,mail,description,msExchDelegateListLink,altRecipient,lastlogon,accountexpires | export-csv c:\rootfolder3\delegationrights\ad-account-info-delegation.csv


    • Edited by Noe.O Tuesday, February 2, 2016 6:44 PM
    Tuesday, February 2, 2016 6:42 PM

Answers

  • Hi Bill

    Sorry for the long delay.  You are right, this is a multi-value attribute.  I made changes to your script and it worked.

    here is what the final script looks like. :

    Get-ADUser -Filter

    *-SearchBase "ou=city,dc=domain"-Properties mail,description,msExchDelegateListLink,altRecipient |

    Select-objectname,sAMAccountName,mail,description,altrecipient, @{name="msExchDelegateListLink";expression={$_.msExchDelegateListLink -join";"}} |

    Export-Csvc:\scripts\mailboxpermission\export-file.csv-NoTypeInformation

    thanks again for your help and pointing me in the right directions.  Now I know what to do for these multi-valued attributes.

    • Marked as answer by Noe.O Friday, February 5, 2016 5:19 PM
    Friday, February 5, 2016 3:47 PM

All replies

  • Use Get-ADUser instead of the old Quest tools. Specify the properties you want returned via the -Properties parameter:

    http://ss64.com/ps/get-aduser.html


    Tuesday, February 2, 2016 7:00 PM
  • Recreated my script and now it looks like this:

    get-aduser -filter

    *-searchbase "cn=dept,cn=site,dc=domain"| selectname, samaccountname,mail,description,msexchdelegatelistlink,altrecipient | export-csvc:\scritps\export-user-permission.csv

    Ran the script from the Active Directory Poweshell Module and got this error:  Get-ADUser : Directory object not found.

    Let me know if I am doing something wrong on my script, thanks

    Tuesday, February 2, 2016 8:44 PM
  • Made changes to my script:

    get-aduser -filter * -searchbase "ou=dept,ou=site,dc=domain" | select-object name, samaccountname,mail,description,msexchdelegatelistlink,altrecipient | export-csv c:\scritps\export-user-permission.csv

    I was able to create my export file but only two attributes came through - name and samaccountname.

    the other columns for the attributes are blank, with the exception of msexchdelegatelistlink, which shows this data in the field - "Microsoft.ActiveDirectory.Management.ADPropertyValueCollection"

    Will keep trying, thanks

    Tuesday, February 2, 2016 9:07 PM
  • You have to add -Properties with mail, description, msexchDelegateListLink, and altRecipipent to your Get-ADUser command. Otherwise the command will only return default properties and those other output properties will be null.


    Get-ADUser -Filter * -SearchBase "whatever" -Properties mail,description,msExchDelegateListLink,altRecipient |
      Select-Object name,sAMAccountName,mail,description,... |
      Export-Csv whatever.csv -NoTypeInformation
    


    -- Bill Stewart [Bill_Stewart]

    Tuesday, February 2, 2016 9:12 PM
    Moderator
  • You're not specifying the properties to return. See my first post again.

    Tuesday, February 2, 2016 9:13 PM
  • your script seems to work except for the attribute "msExchDelegateListLink".  the output says "Microsoft.ActiveDirectory.Management.ADPropertyValueCollection" for the column msExchDelegateListLink.

    I am running this script from the ActiveDirectory Powershell Module.  Am I doing something wrong?

    thanks

    Tuesday, February 2, 2016 10:32 PM
  • That is a multi-valued attribute. What are you expecting the rows of output to look like?

    -- Bill Stewart [Bill_Stewart]

    Tuesday, February 2, 2016 10:42 PM
    Moderator
  • Hi Bill

    Sorry for the long delay.  You are right, this is a multi-value attribute.  I made changes to your script and it worked.

    here is what the final script looks like. :

    Get-ADUser -Filter

    *-SearchBase "ou=city,dc=domain"-Properties mail,description,msExchDelegateListLink,altRecipient |

    Select-objectname,sAMAccountName,mail,description,altrecipient, @{name="msExchDelegateListLink";expression={$_.msExchDelegateListLink -join";"}} |

    Export-Csvc:\scripts\mailboxpermission\export-file.csv-NoTypeInformation

    thanks again for your help and pointing me in the right directions.  Now I know what to do for these multi-valued attributes.

    • Marked as answer by Noe.O Friday, February 5, 2016 5:19 PM
    Friday, February 5, 2016 3:47 PM
  • Alternatively, you can query AutoDiscover directly, like this: https://gallery.technet.microsoft.com/Get-AlternateMailboxes-00744636

    Mike Crowley | MVP
    My Blog -- Baseline Technologies

    Monday, December 11, 2017 2:24 PM