If you want to check if a local user exists before adding it, there are plenty of methods
You can do for example :
bool Exists = IsUserExists("testUser");
with :
private bool IsUserExists(string sUserName)
{
DirectoryEntry deComputer = new DirectoryEntry("WinNT://" + Environment.MachineName + ", computer");
DirectoryEntries entries = deComputer.Children;
foreach (DirectoryEntry de in entries)
{
if (de.Name.Equals(sUserName, StringComparison.CurrentCultureIgnoreCase))
return true;
}
return false;
}