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;
}