Tuesday, November 27, 2012

Win7 Russian - RunAs command not working with error 1332: No mapping between account names and security IDs was done.

Spent a half day to find the reason for the problem. I am running Windows 7 Professional Russian on my box. Yesterday I discovered that RunAs command was not working. Neither was the "Run as different user" shell menu command. In any case the error message was the same - "No mapping between account names and security IDs was done.". In the case of the RunAs command some extra info was displayed in the console. It was the ERROR_NONE_MAPPED 1332(0x534) error code.

I searched and read Google for many hours, tried different command line arguments, created a new user to test with, double-checked that seclogon (Secondary Logon or "Вторичный вход в систему" in Russian) service is up and running, looked through local security policies to find anything related, even ran a malware detection utility. No luck. I even went so far as creating a small C# snippet that tried to run a process with different credentials:
var pswd = new System.Security.SecureString();
foreach(char ch in "test123")
   pswd.AppendChar(ch);
var psi = new ProcessStartInfo { 
    UserName = @"my-pc/testuser", 
    Password = pswd, 
    FileName = @"c:\windows\system32\notepad.exe",
    WorkingDirectory = @"c:\",
    UseShellExecute = false
    };
Process.Start(psi);
It failed with exactly the same error.

Finally, desperate and disappointed of wasting so much time, I found the cause - the Control Panel/"Clock, Language, and Region"/"Region and Language"/"Administrative"/"Language for non-Unicode programs"/"Change system locale" was set to "English" and that totally broke the internal user account mappings for the underlying system call.
Here is the screenshot of where it is in Russian version of Win7:

Once I had changed the setting to "Russian" and restarted the box everything started to work as expected.

What can I say about that experience? Now I hate localized versions of Windows even more than before.

3 comments:

  1. Спасибо огромное! кто бы мог подумать, что эта ошибка связана с настрйоками языка системы!

    ReplyDelete
  2. А еще нужно создавать логин только из английских букв и цифр и длиной не более 8 символов. Много любви иначе с разнообразием не-ms пром-софта.

    ReplyDelete