Powershell commands with FQDN with a space in it

%3CLINGO-SUB%20id%3D%22lingo-sub-1003255%22%20slang%3D%22en-US%22%3EPowershell%20commands%20with%20FQDN%20with%20a%20space%20in%20it%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1003255%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20in%20a%20new%20company%20that%20has%20a%20OU%20that%20has%20a%20space%20in%20it%2C%20and%20for%20the%20life%20of%20me%20I%20can't%20figure%20out%20how%20to%20do%20a%20powershell%20command%20that%20works%20with%20that.%26nbsp%3B%20Here's%20the%20command%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENew-Remotemailbox%20-Alias%20%22David%20Smith%22%20-Name%20%22David%20Smith%22%20-OnPremisesOrganizationalUnit%20%22OU%3DIntraCompany%20Accounts%2COU%3DUsers%2COU%3DMRS%2CDC%3Dtest%2CDC%3Djohnson%2CDC%3Dnet%22%20-SamAccountName%20%22David%20Smith%22%20-UserPrincipalName%20David.Smith%40123.com%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20always%20seems%20to%20stick%20on%20the%20OU.%26nbsp%3B%20I%20get%20messages%20like%3A%26nbsp%3BOrganizational%20unit%20%22johnson.net%2Ftest%2FMRS%2F'Intracompany%20Accounts'%22%20was%20not%20found.%20Please%20make%20sure%20you%20have%20typed%20it%3CBR%20%2F%3Ecorrectly.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20tried%20all%20kinds%20of%20googling%20to%20figure%20this%20out%2C%20but%20the%20terms%20are%20all%20so%20generic%20that%20it%20comes%20back%20with%20a%20million%20junk%20hits.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20in%20advance.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETed%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1003255%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExchange%20Server%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1007124%22%20slang%3D%22en-US%22%3ERe%3A%20Powershell%20commands%20with%20FQDN%20with%20a%20space%20in%20it%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1007124%22%20slang%3D%22en-US%22%3EHi%3CBR%20%2F%3E%3CBR%20%2F%3EAs%20described%20in%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fexchange%2Ffederation-and-hybrid%2Fnew-remotemailbox%3Fview%3Dexchange-ps%23examples%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fexchange%2Ffederation-and-hybrid%2Fnew-remotemailbox%3Fview%3Dexchange-ps%23examples%3C%2FA%3E%20-%20example%202%20-%20I%E2%80%98d%20suggest%20to%20use%20%E2%80%9E%20-OnPremisesOrganizationalUnit%20%22corp.contoso.com%2FArchive%20Users%22%20instead%20of%20OU%3D...%E2%80%9C%3C%2FLINGO-BODY%3E
New 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=...“