none
Urgent pls..Remote Powershell Code for reads Exchange 2010 Message Tracking log : Exception of type 'System.OutOfMemoryException' was thrown RRS feed

  • Question


  • Hi..

    I have reads Message Tracking log data form Exchange Server 2010 using Remote powershell+VB.net code.
    I have collect 7 days Message Tracking log data only(From 1/19/2012 to 1/26/2012) using -start, -End filter and  and I got the Out of Memory exception from the following line.

     command.Parameters.Add("-Start ",StartTime.Value)
     command.Parameters.Add("-End ", EndTime.Value)
      Try
    
                runspace = RunspaceFactory.CreateRunspace(wsmConnectionInfo)
                runspace.Open()
                pipeline = runspace.CreatePipeline()
                pipeline.Commands.Add(command)
                Dim psObjCollection As Collection(Of PSObject) = pipeline.Invoke()
                .........
                .........
                .........
                .........
    
      Catch ex As Exception
        MessageBox.Show(ex.Message)
      End Try
    

    'The Exception Message is,
    'ex.Message: Exception of type 'System.OutOfMemoryException' was thrown. 

    'Error from PipeLine.Invoke
    I have checked My Exchange server message Tracking files and the specified date each log file size have 10,241kb 9,324 kb 6,345kb, 9,986kb etc..

    Some dates log file have below 2042 kb and that date ranges, my task have works with fine

    SO how can I solve this error?
    Pls help me..
    By
    A Pathfinder..
    JoSwa


    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful"
    Friday, January 27, 2012 6:25 AM

Answers

  • hi.

    i experience the same if i run get-messagetrackinglog cmdlet on windows xp and if the result contains a lot of messages.

    either running the same command on 64-bit system or dividing the searched period into smaller pieces solves the problem for me.

    *note, that each record from tracking log file is represented as an object in memory when using get-messagetrackinglog to search for messages. so it may consume more memory than the file size shows.

    Tuesday, January 31, 2012 1:28 PM
  • Hi ..
    Try to split your dates by 12 hrs.
    eg. Strat Time: 01/02/2012 10:00 Am
        end Time: 03/02/2012 12:00 Am
    'here split you date and add it to a list(of String) type variable.

    change your code like

    for i=0 to mylist.Length-2 
    
    command.Parameters.Add("-Start ",Mylist(i))
     command.Parameters.Add("-End ", Mylis(i+1))
      Try
    
                runspace = RunspaceFactory.CreateRunspace(wsmConnectionInfo)
                runspace.Open()
                pipeline = runspace.CreatePipeline()
                pipeline.Commands.Add(command)
                Dim psObjCollection As Collection(Of PSObject) = pipeline.Invoke()
                .........
                .........
                .........
                .........
    
      Catch ex As Exception
        MessageBox.Show(ex.Message)
      End Try
    .
    Next
    
    

     FAQ:

    ------------------------------------------------------------------------------------------------------------------------------------------------------
    Midtr

    1) I have the string in format of Rs.2, 50,000. Now I want to read the string value as 250000 and insert into database (let assume that Rs 2,50,000 coming from third party like web services, wcf services, or from other application ) can u write the code to remove the commas.

    2) Can a stored procedure call another stored procedure?

    3) Difference between function and stored procedure?

    4) How can you know the number of rows affected by last SQL statement?

    5) What is the use of COMMIT TRANS? 

    6) What are cursors?

    7) Types of indexes?

    8) What is the purpose of UPDATE STATISTICS?

    9) Can u write the code for , I have the date time columns in data base which it stores in the format of date time 01/09/2010 10:02:56 now I want to display the date as 1- sept-2010 ? 

    10) How do you find the duplicate rows in the table? 

    11) What is a typed dataset? 

    12) What are collection classes?

    Array list, dictnory…, 

    Can u tell me the use of dictionary data type? 

    13) What are generics?

    14) What is the use of Partial Classes

    15) What is the use of Enum data type? 

    Side question: it is reference type r value type?

    15) For ex I have

    Public enum
    {
    Sunday =1;
    Monday=2;
    Tuesday=3;
    Wednesday=4;
    .
    .


    I need to fill this into dropdown list?

    16) How the security is implemented in your project? 
    I told like, by implementing the 3-tier architecture, using forms authentication, encrypting the password, query strings.
    Interviewer how you encrypt the password, I mean which approach u choose, or client specified particular process. .. Can u tell me how many methods  you know to encrypt 

    17)I have string value like “This is Subhash” now I want to spilt the word at white spaces and collect the words into array list?
    18) I have a webpage with some text boxes and one button with name refresh, when I click the button all the textboxes should get refresh, how can u achieve this?
    In button event we can write the textbox1.text=”” or text.clear(); 
    Side question if I have 25 control in my webform then for 25 controls you will write text. text=”” ------ so on. 
    How much u can rate Ur self in asp.net out of 5--- 
    19) Does a form authentication is work when cookies are turn off at browser side? H’w can u achieves the forms authentication?
    20) Difference between forms authentication and windows authentication? 
    Side why windows authentication is more secured when compare to forms authentication 
    21) Can u write the query for to retrieve all records which are modified in last 10 days?

    ------------------------------------------------------------------------------------------------------------------------------------------


    Accenture 2+ dot net interview questions,Bangalore

    1.Tell about your Current  project? How the security is implemented , which architecture does you used ?
    2. What are the various technologies you used in current and in previous projects

    I said:  VS2005,VS2008, Sql server 2000,2005,java script ,Ajax, j queries, WCF.

    3. What is the difference between abstract class and interface? Where we use abstract class and interface?
    4. I want a method which it should return a string variable, Boolean variable and integer variables, how do you implement that method?
    Eg: I'm passing date time to method that method should return date , hrs,minutes and it should check date should not less than today's date and return as boolean.
    I said yes we can implement such a methods, by using key word “out “.

      public string getdatetime(string frmDatetime, string out date,int out hrs,int out mints,Boolean Isvalid)

    5. Can we use “out” for the methods of type void? Does it give any compilation or run time error?
    I said: yes we can use for methods of type void also. I does not give any type of errors.
    6. What are sealed classes and static classes?
    7. What is boxing and unboxing?
    8. Why do I'm get an error while try to declare the method?
    public static staticMethod (mainStatic obj)

    I said: yes it will give compilation error without specifying return type.
                public static void staticMethod (mainStatic obj)
                
    9.Let's consider a scenario, I have a Text box when user enter a number in text box, I need  to display the employee's details based on empid; if user enters a string value I need to display based on emp name.
    10. Does C# supports the properties for array types? 
    I said : yes ,it supports 
    for eg: 

    class Class1 
    {
        private string[] MyAssesrts;

        public string[] SubhashProperties 
        {
            get { return MyAssesrts;  }
            set { MyAssesrts = value; }
        }
    }



    class MainClass
    {
        public static int Main(string[] args) 
        {
            Class1 c = new Class1();

            string[] arr = new string[] {"car", "villa",”land”};
            c. SubhashProperties = arr;
            Console.WriteLine(c.SubhashProperties [0]); 
        
            return 0;
        }
    }

    12. You worked on jquries right? What are the various features it overcomes from JavaScript and Ajax?
    13. How to find the text box of id txtname in jquery?
    14. What is SOA? Difference between web services and WCF?
    15. How do you deploy the web services and WCF in production server?
    16. What are the page life cycle events?
    17. In Page load () Does it possible to identify , by which control or event causes post back
    I said: up to my knowledge No, we cannot identify, in page load all the controls and events will be loaded. 
    I'm not sure whether it is a right answer or not?
    17. What are http handlers? Where we use?
    18. I need to insert the data of uploaded excel file to sqlserver, In how many ways we insert?
    I said: 
    First we need to open the oledb connection, query the excel sheet and get excel data to data table or dataset.

     A. we can loop each row form a insert query a string and Executenonquery ().
    B.loop each row collect the data in array lists after looping the all records we can pass the array values to stored procedure.
    C. We can use sql bulk upload utility class, where we insert all the data at a time from data table to backend DB.
    19. So, among these which one is the best you feel?
    I Said: obviously, third one gives the better performance.
    20. How do you validate the data before inserting the data through sql bulk upload?
    21. I’m uploading a large amount of data, my excel sheet contains @ 60000 to one lakh records,
    22. What happens if I got any connection time out error or some other error occurs, how do you handles this error. 
    I said: I faced this situation in my project, first of all we should not allow to the uploading large amount of data we should consider the file size before user uploading, better to allow uploading the small chunks of data , we should also consider production server configuration, 
    Sqlserver:
    21. How do you handle errors in stored procedures?
    I Said: In sql server 2005 and 2008 have a better error handling capable when compare to sqlserver2000, we can use try catch blocks in stored procedures.
    And also we can use @@Error which is a global variable; 
    I explained about error_message (), error_seveority, error_description ().error_id()
    22. Why we need to specify NoLock? Do we use Nolock while performing the DML operations, what happened if use?
    I said: Nolock should specify  after the table name while performing the select statement, by default while executing the select statement sqlserver  lock the table, for eg my query takes 6 sec to execute these 6 sec sq server will not allow to perform the any other DML Operations on that table


    i don't know whether  this is a right or not....
    Project Manager Round
    How much years of experience do you have? 
    Where you’re working, from how many years your working with present company?
    What are projects you handled, what is the project you feel this is very tough project?
     What you feel that much of toughness in this project?
    Did you interact with the client at any time? 
    How Do you get the domain knowledge?

    -----------------------------------------------------------------------
    Polaris Dotnet Interview Questions 

    1. Explain about your current project?
    2. Which type of architecture is used and how the security is implemented in your project?
    3. Rate yourself in asp.net, C#, Sqlserver, Ajax?
    I said 4,4,3,4
    4. What is partial page post back?
    5. Let’s consider a button inside the update panel and a label outside the update panel, h’w can I update the label control on button click event?
    6. Consider a button inside the update panel which is calling java script function on button click event, but java script is not executing  when user clicks on the button what  could be the reason? How you make it to work?
    7. Consider a webpage is loading very slowly in production, how do you identify the reasons why it is loading slowly… 
    Interviewer asks many side questions like how you optimize the C# code, sql queries, does sql functions cause any performance issues.
    8. Difference between web services and WCF?
    9. How do you  host the WCF? 
    10. What is a service contract and data contract?
    11. How can you rate yourself in JavaScript and oops?
    12. How to convert a string variable to int in java script?
    13. Side how do you debug the java script code?
    14. How do you overcome the browser incompatible issues..?
    15. Difference between ref and out?
    16. Where should we use Interface and where should we use abstract classes?
    17. Can you tell me what are best Programming practices that you are implementing in your projects…?
    18. Does writing the try, catch blocks in the code causes any performance issues?
    Sql Server
    19. What is the difference between Lock and no lock?
    20. Write the syntax for case statement?
    21. Types of joins?
    22. Triggers, Stored procedures

    Please send your dot net interview experinces to my mail id: nsubhash007@gmail.com


    CTS Dotnet Interview Questions


    1.       Ca n you explain the page life cycle event in asp.net?
    2.       How can I apply the themes and skin to WebPages..?
    3.       What is the Auto Event wired property?
    4.       Is web.config file is mandatory to run the web application?
    No, but it is always better to choose the Web.config file
    5.       What are the features of config file you have used?
    6.       How I can use web.config file for error handling?
    7.       Take the scenario where I’m not using web.config file in my application, is there any other place where I can write the connection string?
    8.       I want to display the some  data  from two different data sources ,say  sql server,ms access ; can you tell me the steps   to display  data on webform ? 
    9.       I want to display a data in gridview (Paging also)?  Which one is the good either data set or data reader?
    10.   Difference between data reader and data set? What is meant by forward cursor only?
    11.   How to use update panel? 
    12.   What is the use of script manager? I have master page and content page in which page I need to use script manager?
    13.   You have any experience in wcf?  What is SOA? 

    Oops
    14.   What are the static classes?
    15.   Can static classes contain non static members?
    16.   Method overloading and method overriding   where you implemented in your project?
    Sql Server 
    17.   What is the composite key?
    18.   Did you face any performance issues in your application? Let us say a web page loading very slow ly?  How you speed up  the webpage 
    19.   How you will the optimize the query? What are the steps you will take?
    20.   Date Diff function?
    21.   What is the use of cursors?
    22.    Table 1 : empid(pk), empname ,deptid(fk)
    Table2: deptid(pk) ,deptname

    Count of employees in each department?

    I hope it will helps to you..
    By
    P Elayaraja


    -------------------------------------------------------------------------------- ------------------------------------------------------------ If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful"

    Friday, February 3, 2012 4:36 PM

All replies

  • Hi to all..

    Still I didn't get any solution..

    Thanks in Advance


    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful"
    Monday, January 30, 2012 7:06 AM
  • hi.

    i experience the same if i run get-messagetrackinglog cmdlet on windows xp and if the result contains a lot of messages.

    either running the same command on 64-bit system or dividing the searched period into smaller pieces solves the problem for me.

    *note, that each record from tracking log file is represented as an object in memory when using get-messagetrackinglog to search for messages. so it may consume more memory than the file size shows.

    Tuesday, January 31, 2012 1:28 PM
  • Hi ..
    Try to split your dates by 12 hrs.
    eg. Strat Time: 01/02/2012 10:00 Am
        end Time: 03/02/2012 12:00 Am
    'here split you date and add it to a list(of String) type variable.

    change your code like

    for i=0 to mylist.Length-2 
    
    command.Parameters.Add("-Start ",Mylist(i))
     command.Parameters.Add("-End ", Mylis(i+1))
      Try
    
                runspace = RunspaceFactory.CreateRunspace(wsmConnectionInfo)
                runspace.Open()
                pipeline = runspace.CreatePipeline()
                pipeline.Commands.Add(command)
                Dim psObjCollection As Collection(Of PSObject) = pipeline.Invoke()
                .........
                .........
                .........
                .........
    
      Catch ex As Exception
        MessageBox.Show(ex.Message)
      End Try
    .
    Next
    
    

     FAQ:

    ------------------------------------------------------------------------------------------------------------------------------------------------------
    Midtr

    1) I have the string in format of Rs.2, 50,000. Now I want to read the string value as 250000 and insert into database (let assume that Rs 2,50,000 coming from third party like web services, wcf services, or from other application ) can u write the code to remove the commas.

    2) Can a stored procedure call another stored procedure?

    3) Difference between function and stored procedure?

    4) How can you know the number of rows affected by last SQL statement?

    5) What is the use of COMMIT TRANS? 

    6) What are cursors?

    7) Types of indexes?

    8) What is the purpose of UPDATE STATISTICS?

    9) Can u write the code for , I have the date time columns in data base which it stores in the format of date time 01/09/2010 10:02:56 now I want to display the date as 1- sept-2010 ? 

    10) How do you find the duplicate rows in the table? 

    11) What is a typed dataset? 

    12) What are collection classes?

    Array list, dictnory…, 

    Can u tell me the use of dictionary data type? 

    13) What are generics?

    14) What is the use of Partial Classes

    15) What is the use of Enum data type? 

    Side question: it is reference type r value type?

    15) For ex I have

    Public enum
    {
    Sunday =1;
    Monday=2;
    Tuesday=3;
    Wednesday=4;
    .
    .


    I need to fill this into dropdown list?

    16) How the security is implemented in your project? 
    I told like, by implementing the 3-tier architecture, using forms authentication, encrypting the password, query strings.
    Interviewer how you encrypt the password, I mean which approach u choose, or client specified particular process. .. Can u tell me how many methods  you know to encrypt 

    17)I have string value like “This is Subhash” now I want to spilt the word at white spaces and collect the words into array list?
    18) I have a webpage with some text boxes and one button with name refresh, when I click the button all the textboxes should get refresh, how can u achieve this?
    In button event we can write the textbox1.text=”” or text.clear(); 
    Side question if I have 25 control in my webform then for 25 controls you will write text. text=”” ------ so on. 
    How much u can rate Ur self in asp.net out of 5--- 
    19) Does a form authentication is work when cookies are turn off at browser side? H’w can u achieves the forms authentication?
    20) Difference between forms authentication and windows authentication? 
    Side why windows authentication is more secured when compare to forms authentication 
    21) Can u write the query for to retrieve all records which are modified in last 10 days?

    ------------------------------------------------------------------------------------------------------------------------------------------


    Accenture 2+ dot net interview questions,Bangalore

    1.Tell about your Current  project? How the security is implemented , which architecture does you used ?
    2. What are the various technologies you used in current and in previous projects

    I said:  VS2005,VS2008, Sql server 2000,2005,java script ,Ajax, j queries, WCF.

    3. What is the difference between abstract class and interface? Where we use abstract class and interface?
    4. I want a method which it should return a string variable, Boolean variable and integer variables, how do you implement that method?
    Eg: I'm passing date time to method that method should return date , hrs,minutes and it should check date should not less than today's date and return as boolean.
    I said yes we can implement such a methods, by using key word “out “.

      public string getdatetime(string frmDatetime, string out date,int out hrs,int out mints,Boolean Isvalid)

    5. Can we use “out” for the methods of type void? Does it give any compilation or run time error?
    I said: yes we can use for methods of type void also. I does not give any type of errors.
    6. What are sealed classes and static classes?
    7. What is boxing and unboxing?
    8. Why do I'm get an error while try to declare the method?
    public static staticMethod (mainStatic obj)

    I said: yes it will give compilation error without specifying return type.
                public static void staticMethod (mainStatic obj)
                
    9.Let's consider a scenario, I have a Text box when user enter a number in text box, I need  to display the employee's details based on empid; if user enters a string value I need to display based on emp name.
    10. Does C# supports the properties for array types? 
    I said : yes ,it supports 
    for eg: 

    class Class1 
    {
        private string[] MyAssesrts;

        public string[] SubhashProperties 
        {
            get { return MyAssesrts;  }
            set { MyAssesrts = value; }
        }
    }



    class MainClass
    {
        public static int Main(string[] args) 
        {
            Class1 c = new Class1();

            string[] arr = new string[] {"car", "villa",”land”};
            c. SubhashProperties = arr;
            Console.WriteLine(c.SubhashProperties [0]); 
        
            return 0;
        }
    }

    12. You worked on jquries right? What are the various features it overcomes from JavaScript and Ajax?
    13. How to find the text box of id txtname in jquery?
    14. What is SOA? Difference between web services and WCF?
    15. How do you deploy the web services and WCF in production server?
    16. What are the page life cycle events?
    17. In Page load () Does it possible to identify , by which control or event causes post back
    I said: up to my knowledge No, we cannot identify, in page load all the controls and events will be loaded. 
    I'm not sure whether it is a right answer or not?
    17. What are http handlers? Where we use?
    18. I need to insert the data of uploaded excel file to sqlserver, In how many ways we insert?
    I said: 
    First we need to open the oledb connection, query the excel sheet and get excel data to data table or dataset.

     A. we can loop each row form a insert query a string and Executenonquery ().
    B.loop each row collect the data in array lists after looping the all records we can pass the array values to stored procedure.
    C. We can use sql bulk upload utility class, where we insert all the data at a time from data table to backend DB.
    19. So, among these which one is the best you feel?
    I Said: obviously, third one gives the better performance.
    20. How do you validate the data before inserting the data through sql bulk upload?
    21. I’m uploading a large amount of data, my excel sheet contains @ 60000 to one lakh records,
    22. What happens if I got any connection time out error or some other error occurs, how do you handles this error. 
    I said: I faced this situation in my project, first of all we should not allow to the uploading large amount of data we should consider the file size before user uploading, better to allow uploading the small chunks of data , we should also consider production server configuration, 
    Sqlserver:
    21. How do you handle errors in stored procedures?
    I Said: In sql server 2005 and 2008 have a better error handling capable when compare to sqlserver2000, we can use try catch blocks in stored procedures.
    And also we can use @@Error which is a global variable; 
    I explained about error_message (), error_seveority, error_description ().error_id()
    22. Why we need to specify NoLock? Do we use Nolock while performing the DML operations, what happened if use?
    I said: Nolock should specify  after the table name while performing the select statement, by default while executing the select statement sqlserver  lock the table, for eg my query takes 6 sec to execute these 6 sec sq server will not allow to perform the any other DML Operations on that table


    i don't know whether  this is a right or not....
    Project Manager Round
    How much years of experience do you have? 
    Where you’re working, from how many years your working with present company?
    What are projects you handled, what is the project you feel this is very tough project?
     What you feel that much of toughness in this project?
    Did you interact with the client at any time? 
    How Do you get the domain knowledge?

    -----------------------------------------------------------------------
    Polaris Dotnet Interview Questions 

    1. Explain about your current project?
    2. Which type of architecture is used and how the security is implemented in your project?
    3. Rate yourself in asp.net, C#, Sqlserver, Ajax?
    I said 4,4,3,4
    4. What is partial page post back?
    5. Let’s consider a button inside the update panel and a label outside the update panel, h’w can I update the label control on button click event?
    6. Consider a button inside the update panel which is calling java script function on button click event, but java script is not executing  when user clicks on the button what  could be the reason? How you make it to work?
    7. Consider a webpage is loading very slowly in production, how do you identify the reasons why it is loading slowly… 
    Interviewer asks many side questions like how you optimize the C# code, sql queries, does sql functions cause any performance issues.
    8. Difference between web services and WCF?
    9. How do you  host the WCF? 
    10. What is a service contract and data contract?
    11. How can you rate yourself in JavaScript and oops?
    12. How to convert a string variable to int in java script?
    13. Side how do you debug the java script code?
    14. How do you overcome the browser incompatible issues..?
    15. Difference between ref and out?
    16. Where should we use Interface and where should we use abstract classes?
    17. Can you tell me what are best Programming practices that you are implementing in your projects…?
    18. Does writing the try, catch blocks in the code causes any performance issues?
    Sql Server
    19. What is the difference between Lock and no lock?
    20. Write the syntax for case statement?
    21. Types of joins?
    22. Triggers, Stored procedures

    Please send your dot net interview experinces to my mail id: nsubhash007@gmail.com


    CTS Dotnet Interview Questions


    1.       Ca n you explain the page life cycle event in asp.net?
    2.       How can I apply the themes and skin to WebPages..?
    3.       What is the Auto Event wired property?
    4.       Is web.config file is mandatory to run the web application?
    No, but it is always better to choose the Web.config file
    5.       What are the features of config file you have used?
    6.       How I can use web.config file for error handling?
    7.       Take the scenario where I’m not using web.config file in my application, is there any other place where I can write the connection string?
    8.       I want to display the some  data  from two different data sources ,say  sql server,ms access ; can you tell me the steps   to display  data on webform ? 
    9.       I want to display a data in gridview (Paging also)?  Which one is the good either data set or data reader?
    10.   Difference between data reader and data set? What is meant by forward cursor only?
    11.   How to use update panel? 
    12.   What is the use of script manager? I have master page and content page in which page I need to use script manager?
    13.   You have any experience in wcf?  What is SOA? 

    Oops
    14.   What are the static classes?
    15.   Can static classes contain non static members?
    16.   Method overloading and method overriding   where you implemented in your project?
    Sql Server 
    17.   What is the composite key?
    18.   Did you face any performance issues in your application? Let us say a web page loading very slow ly?  How you speed up  the webpage 
    19.   How you will the optimize the query? What are the steps you will take?
    20.   Date Diff function?
    21.   What is the use of cursors?
    22.    Table 1 : empid(pk), empname ,deptid(fk)
    Table2: deptid(pk) ,deptname

    Count of employees in each department?

    I hope it will helps to you..
    By
    P Elayaraja


    -------------------------------------------------------------------------------- ------------------------------------------------------------ If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful"

    Friday, February 3, 2012 4:36 PM
  • Thanks
    for your feedback
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful"
    Saturday, February 4, 2012 7:12 AM