Reputation:
What is the goal - Automatically program outlook profiles without client/user intervention. They should just click on Outlook and there email show up first time. No setup or configuration for the end user.
I work for a MSP that has about 70 clients. Each client uses Office E3 licenses for office apps but they use a third party company for there email hosting (intermedia/serverdata).
This specific difference makes it very hard to setup outlook profiles automatically using ZeroConfigExchange based on autodiscover and the smtp address of the AD user. The users are using Azure AD to connect to computers but there Azure AD has no clue what the smtp address is for the user because they don't have exchange online with microsoft but rather, they have exchange online with intermedia/serverdata.
So I have been try very hard to find any method to automatically create an outlook profile based on email address, server address, and credentials; so that when the user first gets there device, it will add the outlook profile to there account.
What I have looked into:
Trying the ZeroConfigExchange anyway - failed - It doesn't know where the smtp information is to create the profile.
Tried using PowerMapi's New-MapiProfile - failed - found out from here: https://superuser.com/questions/1141519/configuring-outlook-with-powershell that this will not work on office 2016 or office 365 as they change the credential setup
Tried using O365 configuration tool to make a customized version of office apps that include the email profile - failed - apparently they took this feature out of the newer O365 configuration tool. This used to be in the older versions from what my research says but its not there anymore: (I don't have enough rep points for pictures so here are links to my pictures) https://i.ibb.co/jftNVg2/help1.png https://i.ibb.co/8ggz5hg/help2.png
Tried using this powershell script I found from here:
$continue = [System.Windows.Forms.MessageBox]::Show("This will delete any outlook profile on your machine. Do you want to continue?", "Continue?", 'YesNo', 'Question')
if ($continue -eq "Yes")
{
# Create Outlook COM instance
Add-Type -assembly "Microsoft.Office.Interop.Outlook"
$Outlook = New-Object -comobject Outlook.Application
$namespace = $outlook.GetNameSpace('MAPI')
$outbox = $namespace.GetDefaultFolder([Microsoft.Office.Interop.Outlook.OlDefaultFolders]::olFolderOutbox)
$Drafts = $namespace.GetDefaultFolder([Microsoft.Office.Interop.Outlook.OlDefaultFolders]::olFolderDrafts)
do
{
$set = $outbox.Items
foreach ($item in $set)
{
[void]$item.move($Drafts)
}
Start-Sleep -Seconds 3 | Out-Null
}
while ($outbox.items.count -ne 0)
# Quick rest before killing COM
Start-Sleep -Seconds 3 | Out-Null
# Kill Outlook COM instance
$outlook.Quit() | Out-Null
[System.Runtime.InteropServices.Marshal]::ReleaseComObject($outlook) | Out-Null
if (Get-Process outlook)
{
Get-Process outlook | Stop-Process | Out-Null
}
if (Test-Path "$Env:appdata\Microsoft\Outlook\")
{
Try
{
$void = Remove-Item "$Env:appdata\Microsoft\Outlook\" -force -recurse | Out-Null
}
Catch
{
[void][System.Windows.Forms.MessageBox]::Show("A file was still in use, try again.", "Information", 'OK', 'Error')
}
}
if (Test-Path HKCU:\Software\Microsoft\Office\16.0\Outlook)
{
#New-ItemProperty -Path HKCU:\Software\Microsoft\Office\16.0\Outlook\AutoDiscover -Name ZeroConfigExchange -Value 1 -PropertyType DWORD -Force
Remove-Item "HKCU:\Software\Microsoft\Office\16.0\Outlook\Profiles\*" -Recurse -Force | Out-Null
Remove-ItemProperty -Path HKCU:\Software\Microsoft\Office\16.0\Outlook\Setup\ -name First-Run | Out-Null
Start-Process 'C:\Program Files (x86)\Microsoft Office\root\Office16\outlook.exe' | Out-Null
}
else
{
#do nothing
}
}
else
{
[void][System.Windows.Forms.MessageBox]::Show("Nothing was done", "Information", 'OK', 'Information')
}
This is able to bring up the prompts for the email setup but is there anyway to include that in this powershell script?
I also tried a little bit of the mfcmapi app from here: https://learn.microsoft.com/en-us/office/client-developer/outlook/mapi/how-to-create-an-outlook-profile-using-mfcmapi
But I got sooooo many errors just following the documentation from microsoft and researching the random errors didn't really get me far. It almost seems like as if the mfcmapi is completely broken.
I also asked this question here: https://superuser.com/questions/1640825/autoconfigure-m365-outlook-profile yesterday but I have added way more of my troubleshooting in this thread. I will also be making a support request with Microsoft to see if there is any ideas.
If I find a good answer for others I will let everyone know.
Thank you for your time,
Upvotes: 1
Views: 12909
Reputation: 1
That code may do a little bit more than this one. But this accomplishes about the same in three lines. Other than the below code, which just empties the AppData:
Remove-Item "$Env:appdata\Microsoft\Outlook\" -force -recurse
You can add that and, if it doesn't exist, it moves on. This isn't the solution to your issue, but this code is easier than the long code above:
Remove-Item "HKCU:\Software\Microsoft\Office\16.0\Outlook\Profiles\*" -Recurse -Force
New-Item -Path HKCU:\SOFTWARE\Microsoft\Office\16.0\Outlook\Profiles -Name O365! -force
start-process -name outlook
Upvotes: 0
Reputation: 66255
You can also try ProfMan library (disclaimer: I am its author) - it can be easily used to pre-create an Outlook profile for an Office 365 mailbox - see https://www.dimastr.com/redemption/profman_examples.htm#ROH_Profile_Outlook2016
Upvotes: 0