Forum Discussion

Jürgen Rösch's avatar
Jürgen Rösch
Copper Contributor
Sep 08, 2017
Solved

Exchange Online New-Mailuser missing

Hello,

 

since a few weeks, my Powershell-Script is not working anymore to create Mail-Only Users. Any ideas where the command is gone?

 

Thats the error:

 

 

Error:  System.Management.Automation.CommandNotFoundException: The term 'New-MailUser' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
   at System.Management.Automation.CommandDiscovery.LookupCommandInfo(String commandName, CommandTypes commandTypes, SearchResolutionOptions searchResolutionOptions, CommandOrigin commandOrigin, ExecutionContext context)
   at System.Management.Automation.CommandDiscovery.LookupCommandProcessor(String commandName, CommandOrigin commandOrigin, Nullable`1 useLocalScope)
   at System.Management.Automation.ExecutionContext.CreateCommand(String command, Boolean dotSource)
   at System.Management.Automation.PipelineOps.AddCommand(PipelineProcessor pipe, CommandParameterInternal[] commandElements, CommandBaseAst commandBaseAst, CommandRedirection[] redirections, ExecutionContext context)
   at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
   at lambda_method(Closure , Object[] , StrongBox`1[] , InterpretedFrame )

  • Also make sure you have the relevant permissions. By default, you need to have the "Mail Recipient Creation" role assigned in order to use this cmdlet.

4 Replies

  • I just ran New-MailUser and was able to create a new object. Are you absolutely sure that you have connected a session to Exchange Online?

    • VasilMichev's avatar
      VasilMichev
      MVP

      Also make sure you have the relevant permissions. By default, you need to have the "Mail Recipient Creation" role assigned in order to use this cmdlet.

      • Jürgen Rösch's avatar
        Jürgen Rösch
        Copper Contributor

        Hey.. that was the problem... I was using a different user in the past. No I've changed back and it's working again.

         

        Thanks