Is it possible to add multiple emails onto an outlook profile?

Tony 0 Reputation points
2023-07-20T19:04:28.8866667+00:00

I am attempting to add new users emails to an existing outlook email profile without the use of Azure or Exchange. I have tried using this PowerShell script but I am unable to see the new user's email in the outlook profile.

# Prompt the user for input 
$profileName = Read-Host "Enter your existing Outlook profile name" 
$emailAddress = Read-Host "Enter the email address of the additional account" 
$password = Read-Host "Enter the password for the additional account" -AsSecureString  

# Convert the secure string password to plain text 
$passwordText= [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($password))  

# Add the new account to the existing profile 
$accountPath = "HKCU:AppData\Local\Microsoft\Outlook\Profiles\$profileName\9375CFF0413111d3B88A00104B2A6676\" $accountNumber = Get-ChildItem $accountPath | Measure-Object | Select-Object -ExpandProperty Count $accountNumber++  

# Set default server values if not provided
if ([string]::IsNullOrEmpty($smtpServer)) {     $smtpServer = "smtp.example.com" } 
if ([string]::IsNullOrEmpty($imapServer)) {     $imapServer = "imap.example.com" }  

# Create the new account registry key $accountKeyPath = Join-Path $accountPath $accountNumber New-Item -Path $accountKeyPath -Force | Out-Null  

# Set the new account properties 
Set-ItemProperty -Path $accountKeyPath -Name "SMTP Server" -Value $smtpServer 
Set-ItemProperty -Path $accountKeyPath -Name "IMAP Server" -Value $imapServer 
Set-ItemProperty -Path $accountKeyPath -Name "SMTP User" -Value $emailAddress 
Set-ItemProperty -Path $accountKeyPath -Name "SMTP Password" -Value $passwordText 
Set-ItemProperty -Path $accountKeyPath -Name "SMTP Port" -Value 587 
Set-ItemProperty -Path $accountKeyPath -Name "IMAP Port" -Value 993 

# Display a confirmation message 
Write-Host "The additional email account has been added to the '$profileName' profile."

Am I going in the right direction? Should I use another method? Thank you in advance for your assistance!

Outlook
Outlook
A family of Microsoft email and calendar products.
4,504 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,884 questions
{count} votes

2 answers

Sort by: Most helpful
  1. ChristyZhang-MSFT 25,871 Reputation points Microsoft External Staff
    2023-07-21T02:23:24.36+00:00

    Hi @Tony ,

    Welcome to our forum!

    I am attempting to add new users emails to an existing outlook email profile without the use of Azure or Exchange.

    What do you mean about "without the use of Azure or Exchange"?

    As i know, we can only add email accounts one by one to a Outlook profile manually in Outlook desktop client. Please open Outlook and click File>Add Account.

    16


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Rich Matheisen 47,771 Reputation points
    2023-07-27T18:16:29.2033333+00:00

    Are you logged in as that user? The "HKCU" (HKEY_CURRENT_USER) you're updating may be your own, not the target user!


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.