Powershell commands with FQDN with a space in it

Copper Contributor

I'm in a new company that has a OU that has a space in it, and for the life of me I can't figure out how to do a powershell command that works with that.  Here's the command:

 

New-Remotemailbox -Alias "David Smith" -Name "David Smith" -OnPremisesOrganizationalUnit "OU=IntraCompany Accounts,OU=Users,OU=MRS,DC=test,DC=johnson,DC=net" -SamAccountName "David Smith" -UserPrincipalName David.Smith@123.com

 

It always seems to stick on the OU.  I get messages like: Organizational unit "johnson.net/test/MRS/'Intracompany Accounts'" was not found. Please make sure you have typed it
correctly.

 

I've tried all kinds of googling to figure this out, but the terms are all so generic that it comes back with a million junk hits.

 

Thanks in advance.

 

Ted

 

1 Reply
Hi

As described in https://docs.microsoft.com/en-us/powershell/module/exchange/federation-and-hybrid/new-remotemailbox?... - example 2 - I‘d suggest to use „ -OnPremisesOrganizationalUnit "corp.contoso.com/Archive Users" instead of OU=...“