public IHttpActionResult Post([FromBody] CreateUser user) { var script = _powershellScriptLoader.LoadScript(PowershellScripts.CreateUser); var samAccountName = _samAccountNameGenerator.GenerateSamAccountName(user.Upn); _powerShellManager.AttachParameters(user.MapPropertiesToActiveDirectoryParameters()); _powerShellManager .AddParameter("samAccountName", samAccountName) .AddParameter("baseHostingOu", _configurationManager.GetByKey("BaseHostingOu")) .AddParameter("targetDomainController", _configurationManager.GetByKey("TargetDomainController")); _powerShellManager.ExecuteScript(script); return(Ok(new UserCreated { SamAccountName = samAccountName })); }