I have a jenkins node running on a windows server 2019. The Jenkins service runs with privileges of a windows service user which has no admin rights on that server.
When I’ve been logged in with this service user on the windows server and start the powershell script in the Powershell ISE environment, this works fine, but when this ps1 script is called within a Jenkins pipeline it throws an error “access denied”.
powershell.exe : New-Object : Retrieving the COM class factory for component with CLSID {67F4E0FA-46A7-4255-B084-69A9433D08C3} failed At C:\KBData\Jenkins_Home\workspace\PureVariants EA Model Transformation@tmp\durable-f80e2bfd\powershellWrapper.ps1:3 char:1 + & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Comm … + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (New-Object : Re…3D08C3} failed :String) , RemoteException + FullyQualifiedErrorId : NativeCommandError due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)). At C:\KBData\Sandbox\EA-models\project_transfer_cvsm.ps1:32 char:7 + $ea = New-Object -ComObject “EA.Repository” -Strict + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: ( [New-Object], UnauthorizedAccessException + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.NewObjectCommand
Has someone an idea why this COM class can not be instantiated in jenkins node context despite the Jenkins service runs with privileges of the service user?
It looks like the error comes from how Windows handles COM objects when Jenkins is running as a service. In a service context, the process is in Session 0 (non-interactive), which often prevents COM objects from starting properly, especially those that expect a desktop session or elevated rights.
A few things you might try:
Interactive desktop access
Some COM objects (for example, EA.Repository) don’t behave well in Session 0. If that’s the case, you may have better luck running the Jenkins agent as a regular process in an interactive session instead of as a Windows service.
Permissions via DCOMCNFG
It may help to grant your Jenkins service account explicit “Launch and Activation” permissions for the COM class. You can configure this through dcomcnfg.
UAC / policy considerations
On some setups, UAC or local security policies can block non-admin accounts from creating COM objects. Checking the local policy settings might be worth a shot.
So in practice, two common paths forward are:
Adjust the DCOM permissions, so the service account can create the COM object.
Run the Jenkins agent interactively (instead of as a service) under the account that needs COM access.
This behavior is fairly typical on Windows when trying to automate COM from a background service, so it may take a bit of experimentation depending on the COM component you’re working with.
Option 1: Grant DCOM permissions to the Jenkins service account
Open Component Services
Press Win + R, type dcomcnfg, and hit Enter.
This opens Component Services.
Navigate to the COM class
In the left tree: Component Services → Computers → My Computer → DCOM Config
Find the COM object you’re working with (e.g., EA.Repository).
Adjust security settings
Right-click the COM object → Properties.
Go to the Security tab.
Launch and Activation Permissions
Under Launch and Activation Permissions, click Edit.
Add the Jenkins service account (the one Jenkins is running under).
Grant it at least:
Local Launch
Local Activation
If the agent runs remotely, you might also need Remote Launch/Activation.
Save and restart Jenkins
Click OK to save settings.
Restart the Jenkins service, so the new permissions take effect.
Option 2: Run Jenkins agent interactively
Sometimes the easiest fix is to avoid Session 0 entirely.
Stop the service
Open Services.msc.
Find Jenkins Agent (or the Windows service you installed for Jenkins).
Right-click → Stop.
Launch as a process instead of a service
Open a command prompt as the Jenkins user (e.g., with runas /user:jenkins cmd).
This ensures the agent runs in the user’s interactive session, where COM access typically works fine.
Make it persistent
You could wrap this in a scheduled task that runs “at logon” for the Jenkins user.
That way, whenever the machine reboots, the agent starts automatically in an interactive session.
Summary
If you want to keep Jenkins as a service: Use dcomcnfg to explicitly grant your service account permissions on the COM class.
If the COM object simply doesn’t work in Session 0: Run the Jenkins agent interactively (scheduled task at logon is a good compromise).
Here’s a ready-to-use Scheduled Task XML that should launch the Jenkins agent in an interactive session at user logon. You could import this into Task Scheduler instead of building it by hand.
Replace DOMAIN\JENKINSUSER with the actual Jenkins user account.
Update paths:
C:\jenkins\agent.jar → where you keep the agent JAR.
https://YOUR_JENKINS_URL/... → your Jenkins controller URL.
AGENT_NAME and YOUR_SECRET → values from the Jenkins agent config page.
Result
Whenever the Jenkins user logs in, Windows should start the Jenkins agent in their interactive desktop session. That way, COM objects like EA.Repository that require interactive access should initialize correctly.
All of this does not work for me! My query to the EA SparxSystems Support results in the answer that EA UI doesn’t support DCOM. Assuming that the UI and even a logged in user is recommended when instantiating this COM class.