Error message

This topic contains 4 replies, has 3 voices, and was last updated by  Tony Antony 1 year, 3 months ago.

  • Author
  • #65115

    Tony Antony

    I have a list of emails (about 1400), and I'm able to delete the email from the list and re-order numerically without issue for some, but when I try to delete some, it says the message below.

    Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.Int32".

    All the emails are in the same exact format, for example, 1=1. How would I fix this?

    Thank you,


  • #65128

    Daniel Krebs

    Please post your script.

  • #65137

    Tony Antony

    Its' about 230 lines, but this is where the trouble is


    $Look_UP = $Read_INI[$Start..$Calender_End]
            $Find = $Read_INI[$Calender_Start..$Calender_End] -cmatch "^\d+=$User_Index$"
            $Next = [int]$Find.Split("=")[0] - 1
            foreach ($Items in $Look_UP)
                $Replace = $Items -creplace("\A\d+","$Next") 
                $Read_INI = $Read_INI -replace("$Items","$Replace")
  • #65154

    Curtis Smith

    It's a guess based on the little bit of information provide, but I would suspect the problem is either your $start or $calender_end variables. Based on the error message, one or both of them are system object, not integers, and to get positions in an array the was you are doing here, the $start and $calender_end variables have to be integers.

    $Look_UP = $Read_INI[$Start..$Calender_End]

    You can check their type by doing:

    get-member -inputobject $start
    get-member -inputobject $calender_end

    • #65164

      Tony Antony

      Thank you Curtis, I'll try that

You must be logged in to reply to this topic.