Book a Demo

Author Topic: Powershell Repository.Execute NullRef exception  (Read 181 times)

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1417
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
Powershell Repository.Execute NullRef exception
« on: September 29, 2026, 10:32:23 pm »
Hi,
I'm working on a Powershell script that uses EA API. It works well except calling the Repository.Execute method to run INSERT/UPDATE/DELETE queries doesn't work.
I get the following exception:  CategoryInfo          : OperationStopped: (:) [], NullReferenceException

Everything else like Repository.SQLQuery work fine

Is there a workaround to get the Execute method to work ?

Thanks
Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13542
  • Karma: +577/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Powershell Repository.Execute NullRef exception
« Reply #1 on: September 29, 2026, 11:22:33 pm »
Do you mean in version 17.2?

That is one of the new "features" of 17.2. Repository.Execute() doesn't work anymore.

Geert

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1417
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
Re: Powershell Repository.Execute NullRef exception
« Reply #2 on: September 29, 2026, 11:48:16 pm »
Hi Geert

I'm indeed running the latest build and I confirm it is supported in earlier builds (I successfully ran it using a 16xx build)
Hopefully this "feature" will be removed in the next build  ;)

I have both EA 17.2 and 16.1 installed on the same machine. I wonder if there's a way in PowerShell to force using EA16.1 when creating the object "$Repository = New-Object -ComObject EA.Repository" ?

« Last Edit: September 29, 2026, 11:56:29 pm by Guillaume »
Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com


Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8116
  • Karma: +119/-20
    • View Profile
Re: Powershell Repository.Execute NullRef exception
« Reply #3 on: September 30, 2026, 08:23:50 am »
I'm indeed running the latest build and I confirm it is supported in earlier builds (I successfully ran it using a 16xx build)
Minor correction. It was never supported, it was never documented.

I've personally commented many times here when someone suggested it here that it's unsupported and may be removed without notice.

Now it has.

It's come up a lot as a vulnerability just because it exists. Enough that we had to do something about it.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13542
  • Karma: +577/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Powershell Repository.Execute NullRef exception
« Reply #4 on: September 30, 2026, 04:35:25 pm »
I'm indeed running the latest build and I confirm it is supported in earlier builds (I successfully ran it using a 16xx build)
Minor correction. It was never supported, it was never documented.

I've personally commented many times here when someone suggested it here that it's unsupported and may be removed without notice.

Now it has.

It's come up a lot as a vulnerability just because it exists. Enough that we had to do something about it.
Hi Eve,

I understand that. For me personally, I have used it only in those cases where I had no other option.
This was either because something was not exposed in the API, or because the API was way too slow to be usable.

I've sent an email to Sparx support a while ago, listing all of the use cases of Repository.Execute() (and also the use cases of querying the t_sec*** tables), asking for alternatives.
It's been a few weeks now, but I haven't gotten any response yet.

If there is an alternative, I'm the first one to use that, instead of Repository.Execute.

Now I'm afraid I'll have to make some kind of workaround with a direct database connection. Not exactly ideal, especially in large corporate environments.

Geert

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1417
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
Re: Powershell Repository.Execute NullRef exception
« Reply #5 on: September 30, 2026, 08:21:43 pm »
Hi Eve,

I understand the issue of having this method potentially identified as a vulnerability, however I share Geert's feedback i.e. this method is needed in many cases to address the following:
- Update or create information that are not available in the API
- Quicker execution time by 10 times or more compared with API methods, making the script usable (e.g. I've seen scripts running time dropping from over 60 minutes down to 3 minutes)

Is there a way to restore this function whilst adding some level of security?
Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com


Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8116
  • Karma: +119/-20
    • View Profile
Re: Powershell Repository.Execute NullRef exception
« Reply #6 on: October 02, 2026, 09:02:16 am »
Now I'm afraid I'll have to make some kind of workaround with a direct database connection. Not exactly ideal, especially in large corporate environments.
Yeah, that's not ideal. You know what's worse? Bypassing the security measures that are set up to prevent random changes in a database where the people who set up those restrictions have no visibility that it's happening.

- Update or create information that are not available in the API
- Quicker execution time by 10 times or more compared with API methods, making the script usable (e.g. I've seen scripts running time dropping from over 60 minutes down to 3 minutes)
Send in a request for the API changes you need detail exactly what's needed and why. I won't make any assurances that they'll be allowed though.

Is there a way to restore this function whilst adding some level of security?
I can't see any way that it will be allowed.