3
During the installation of my application on a server, the following line is executed:
using (var com = con.CreateCommand())
{
com.CommandText = "CREATE LOGIN [BUILTIN\\Administrators] FROM WINDOWS";
com.ExecuteNonQuery();
}
This code works well when running on English operating systems, but when I tried to run on an operating system in Portuguese it didn’t work.
What would then be the correct command, so that this code can be executed on any operating system, regardless of language?
Did you even test by swapping Administrators for Administrators? Just to see if it works?
– Diego
I will test this now, and I believe it should work. But I have no way of knowing which language of the operating system will be installed. So I still need a command to run in any OS, or at least some way to get the correct system string.
– Marcello
When it comes to Windows, it will be difficult to follow a pattern. If your case is only about English/Portuguese installations, you could create an if by testing the language and then run your command.
– Diego
My case is any installation, in any language, because this application can be used in any country of the world. I’m researching how to get the name "BUILTIN Administrators" in any language.
– Marcello
I was able to solve the problem. There is a way to recover names from known groups, such as the Administrators group, using SID. I will post a reply explaining. Thank you for helping Diego!
– Marcello