ACAT.Applications.ACATTalk.Program.createUser C# (CSharp) Method

createUser() private static method

Creates the specified user using the batchFileName. Executes the batchfile which creates the user folder and copies the initialization files
private static createUser ( String batchFileName, String userName ) : bool
batchFileName String Name of the batchfile to run
userName String Name of the user
return bool
        private static bool createUser(String batchFileName, String userName)
        {
            bool retVal = true;
            try
            {
                var dir = AppDomain.CurrentDomain.BaseDirectory;
                Process proc = new Process
                {
                    StartInfo =
                    {
                        FileName = Path.Combine(dir, batchFileName),
                        WorkingDirectory = dir,
                        Arguments = userName,
                        UseShellExecute = true
                    }
                };

                proc.Start();
                proc.WaitForExit();
                proc.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to create user. Error executing batchfile " + batchFileName + ".\nError: " + ex.ToString());
                retVal = false;
            }
            return retVal;
        }