Script issue creating mailbox in exchange management shell

Copper Contributor

I'm running a script in exchange management shell, using variables to output a command for creating user email accounts. Write-Host does a nice job showing the command string in the management shell, but of course does not execute it.   I've had success using Invoke-Expression followed by a variable representing a string using commandlets such as New-Addresslists and New-Accepteddomain, but when using Invoke-Expression with a variable containing the New-Mailbox commandlet, I get error messages.  How do I properly run a variable string from scripts specifically into the exchange management shell to create user email accounts?


Exchange 2019

1 Reply
Hello, can you show the script in use? what is the error you receive?