How to Repeat execute codeunit with changecompany?

Hi All,
I saw the steps to upgrade NAV from 2009R2 to NAV 2013
there is a step to do Task 4: Step 1 Data Conversion
Since I have more than 50 companies, is there a way i can create code to repeat this? →
https://docs.microsoft.com/en-us/previous-versions/dynamicsnav-2013r2/hh166395(v=nav.71)

same goes for this step → https://docs.microsoft.com/en-us/previous-versions/dynamicsnav-2013r2/hh169256(v=nav.71)
Task 11: Step 2 Data Conversion

I tried using CHANGECOMPANY code, but it only works for Table but not codeunit
is there a way to do so?
Thanks before

It works in a different way for codeunits. You can’t change company for a codeunit, but can execute it in a separate session which is started in a context of a company specified in the session parameters.

STARTSESSION(SessionId,,);

https://docs.microsoft.com/en-us/dynamics-nav/startsession-function–sessions-

Hi Alexander

I tested Startsession like this

Company.RESET;
IF Company.FINDSET THEN
BEGIN
REPEAT
STARTSESSION(SessionID,CODEUNIT::"Upgrade New Version",Company.Name);
UNTIL Company.NEXT = 0;
MESSAGE('Done !');
END;

but seems not working.

any idea?

The idea is that either the codeunit does not have any code in the OnRun trigger, or there is an error that has to be debugged.