0
votes

I am trying to list a user's shared mailboxes. We have a mixed environment so some are mapped automatically through Exchange, and some are not (security group permissions). I want to add a Powershell script to the login process to record all mailboxes a user has loaded in Outlook. I want to save this list to a text file or csv.

I am able to get the names through $outlook.getnamespace("mapi"). However some names have changed and the user's Outlook doesn't show those changes, so this name means nothing when thrown at Exchange or AD, however somehow still magically works.

I need something more concrete, samaccountname or smtp address.. something like that.

EDIT

I have continued to work at this, and with the help of MFCMAPI I was able to determine I need the PR_USER_NAME property. I need to do this with vanilla Powershell to run on a client system (and I have thousands so installing EMS is not an option).

1

1 Answers

1
votes

Use Namespace.Stores collection. MFCMAPI shows MAPI objects which you cannot access in PS. To see live Outlook Object Model objects, use OutlookSpy (it shows both MAPI and OOM objects).

UPDATE: If using Redemption is an option, you can use RDOExchangeMailbox.Owner property:

  skPstAnsi = 1
  skPstUnicode = 2
  skPrimaryExchangeMailbox = 3
  skDelegateExchangeMailbox = 4
  skPublicFolders = 5
  set Session = CreateObject("Redemption.RDOSession")
  Session.MAPIOBJECT = Application.Session.MAPIOBJECT
  for each Store in Session.Stores
    'for i = 1 to Session.Stores.Count
    'set Store = Session.Stores(i)
    Debug.Print Store.Name
    If (Store.StoreKind = skPrimaryExchangeMailbox) or (Store.StoreKind = skDelegateExchangeMailbox) Then
      Debug.Print Store.Owner.SmtpAddress
    End If
    Debug.Print " ------ "
  next