Get-MapiProfile

Description

This cmdlet returns one or more MAPI profiles for the current user.

Syntax
Note: Parameters in orange are optional.
Get-MapiProfile
-ProfileNameString[]
Get-MapiProfile
-GetDefaultProfileSwitchParameter
Parameters
ProfileNameA optional list of one or more string values that are the profile names to return. If this parameter is omitted, Get-MapiProfile will return a list of all configured profiles for the current user
GetDefaultProfileA SwitchParameter which, if present, will return the current default profile, if one is configured.
Remarks

This cmdlet is used to return MAPI profile objects that are often used in other profile cmdlets.

The underlying data of a MAPI profile is stored in the WIndows Registry for the current user.  The registry location us different depending upon the version of Outlook/MAPI installed.  Outlook 2010 and earlier (including Exchange's implementation of MAPI) stores profile data in HKEY_CURRENT_USER/Software/Microsoft/Windows NT/CurrentVersion/Windows Messaging Subsystem/Profiles/<profile name>.  Outlook 2013 and later stores data in HKEY_CURRENT_USER/Software/Microsoft/Office/XX.0/Outlook/Profiles, where 'XX' is the Outlook version number (15=OL2013, 16=OL2016).

Due to the fact that MAPI profile detail is stored in the current user's registry, working with profiles is user specific.  If PowerShell is running as an elevated user, different than the current user, MAPI will have access to profile data for the elevated user, which may result in no profiles at all if the elevated user has never used Outlook or MAPI.  Applications that use MAPI will need read and write access to the registry keys mentioned above, and by default (since they are under HKEY_CURRENT_USER) users have such permission.  For this reason, it is rarely necessary to run PowerMapi in an elevated session.  However, if your script requires elevation for other reasons (file access, network access, etc.), be sure that the PowerShell session is still running as the user with the configured profiles.

Generally, the first MAPI profile created becomes the Default profile for the user.  A default profile, if Outlook is configured for such, allows Outlook to startup without prompting for a profile and will load use the default profile.  However, it is possible to not have any default profiles.  Deleting a profile manually from the registry, for example, could render MAPI without any default profile.