Error message

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,

Tony

Please post your script.

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

$Look_UP

$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)
        {
            $Next++                
            $Replace = $Items -creplace("\A\d+","$Next") 
            $Read_INI = $Read_INI -replace("$Items","$Replace")
        }

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

Thank you Curtis, I’ll try that