Hi,
I recently set up a business role per a post in this thread that creates an on-prem shared mailbox and then moves that mailbox to O365. The issue is that the powershell script to move to O365 keeps erroring out with the following:
Connecting to remote server failed with the following error message: WS-Management cannot process the request. The operation failed because of an HTTP error. HTTP error 12152: server returned an invalid or unrecognized response.
I pulled the script straight from Adaxes support so not sure where it went wrong. The script I grabbed is below (took out variables specific to our environment):
Taken from this forum post: Create user mailbox in Office 365?
# Credentials of a user who has sufficient permissions to provision users for Office 365
$office365AdminName = "removed_for_post" # TODO: modify me
$office365AdminPassword = ConvertTo-SecureString -AsPlainText -Force -String "removed_for_post" # TODO: modify me
$office365DeliveryDomain = "removed_for_post" # TODO: modify me
$office365Credentials = New-Object -TypeName System.Management.Automation.PSCredential($office365AdminName, $office365AdminPassword)
$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://ps.outlook.com/powershell/" -Credential $office365Credentials -Authentication Basic -AllowRedirection
Import-PSSession $session
# Credentials of the local Exchange domain administrator
$localAdminName = $Context.RunAs.UserName + "@" + $Context.RunAs.Domain
$localAdminPassword = ConvertTo-SecureString -AsPlainText -Force -String $Context.RunAs.Password
$localAdminCredentials = New-Object -TypeName System.Management.Automation.PSCredential($localAdminName, $localAdminPassword)
$localDomain = $Context.GetObjectDomain("%distinguishedName%")
try
{
$result = New-MoveRequest -Identity "%username%" -Remote -RemoteHostName $localDomain -TargetDeliveryDomain $office365DeliveryDomain -RemoteCredential $localAdminCredentials -ErrorAction Stop
}
catch
{
$Context.LogMessage($_.Exception.Message, "Error")
}
Remove-PSSession $Session
if ($result -ne $NULL)
{
$Context.LogMessage("Mailbox move request created successfully. Check Exchange logs for details." , "Information")
}