locked
How can I fix ID's that I forgot to append my prefix too? it is 1111 instead of SR1111 RRS feed

  • Question

  • In adding an Oechestrator runbook I forgot to prepend the SR to the {0} and about 20 tickets were created with just numbers for IDs. I tried scripting to change them but it threw an error.

    ##I had already loaded up the $badtickets array with the bad ticket objects.
    
    Foreach ($Ticket in $Badtickets)
        {
        $newticketid="SR" + $Ticket.id
        $Ticket.id=$newticketid
        $Ticket | Update-SCClassInstance
        }
    
    #The error I get is:
    
    Exception setting "Id": "The key value of an object cannot be changed."
    At line:1 char:1
    + $Ticket.Id="SR1125805"
    + ~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [], SetValueInvocationException
        + FullyQualifiedErrorId : ScriptSetValueRuntimeException

    Is there ANYWAY to change these? I could of sworn I had done it before, but I am old and forgetful so I may be wrong.

    Tuesday, March 14, 2017 9:02 PM

Answers