Account Locked out after execute exchange server powershell command

Hi,

I am writing a c# web application to run some exchange server powershell command. The code is below.

The username and password I use is my Window Authentication. For some reason, the program works but in a few minute (for a little bit while after), my account will get locked.

Any suggestion my account get locked would be appreciated.

           string pwd="somepassword";
           string SHELL_URI = "http://schemas.microsoft.com/powershell/Microsoft.Exchange";
           System.Uri serverUri = new Uri(String.Format("http://{0}/powershell?serializationLevel=Full", "somemachine"));

            for (int i = 0; i < pwd.Length; i++)
            {
                securePwd.AppendChar(pwd[i]);
            }

            PSCredential psCredential = new PSCredential("someUserName", securePwd);
            RunspaceConfiguration rc = RunspaceConfiguration.Create();
            WSManConnectionInfo wsManInfo = new WSManConnectionInfo(serverUri, SHELL_URI, psCredential);

            using (Runspace rs = RunspaceFactory.CreateRunspace(wsManInfo))
            {
                wsManInfo.MaximumConnectionRedirectionCount = 1;
                rs.Open();
                PowerShell psh = PowerShell.Create();
                psh.Runspace = rs;                
                     ...
                rs.Close();
            }


September 20th, 2013 9:31pm

I'd suggest you try to trace the source of the lockout its unlikely if your using the correct username and password to be the code your running see http://social.technet.microsoft.com/Forums/windows/en-US/52290128-cda7-4fa9-81d8-66ecf6fb0202/random-account-lockout-how-to-trace-source

Cheers
Glen

Free Windows Admin Tool Kit Click here and download it now
September 23rd, 2013 1:40am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics