Mailbox CustomAttribute

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Dan Potter Dan Potter 1 month, 1 week ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #50965
    Profile photo of Dennis Graham
    Dennis Graham
    Participant

    I need to pull from O365 the following information for each licensed user; I am having difficulty finding the syntax to get CustomAttributes from MailBox. Any suggestions?

    From Get-MsolUser
    UserPrincipalName
    DisplayName
    FirstName
    LastName
    Department
    Office
    Licenses Account SkuId

    From Get-Mailbox
    CustomAttribute 11

    Here is the scrip I run that gets the user info. How can I add to the script to get the CustomAttribute 11 added the csv file?

    Get-MsolUser –all | Where-Object { $_.isLicensed -eq "TRUE" } | Select-Object UserPrincipalName, DisplayName, FirstName, LastName, Department, Office, {$_.Licenses.AccountSkuId} | Export-Csv c:\zip\201607LicensedUsers.csv -NoTypeInformation

    #50982
    Profile photo of Dan Potter
    Dan Potter
    Participant

    This is how you combine objects. replace mailboxmoveremotehostname with the property you want, I just picked one at random that is populated.

    get-msoluser -UserPrincipalName [email protected]' | select userprincipalname,displayname,islicensed,@{n='exonline';e={(Get-Mailbox $_.userprincipalname).MailboxMoveRemoteHostName}}

    • This reply was modified 1 month, 1 week ago by Profile photo of Dan Potter Dan Potter.
    #50990
    Profile photo of Dan Potter
    Dan Potter
    Participant

    In long form it would look something like this.

    $msolusers = Get-MsolUser –all | Where-Object { $_.isLicensed -eq "TRUE" }
    
    foreach($user in $msolusers){
    
    $exchangestuff = (Get-Mailbox $user.userprincipalname).MailboxMoveRemoteHostName
    
    [pscustomobject]@{
    
    upn = $user.userprincipalname
    exchangestuff = $exchangestuff
    #etc..
    
    
    }
    
    
    }
    
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.