Skip to main content

Hi all,

I have created a C# .NET program that performs some automated tasks for us by interfacing with Reflection, using the methods described here https://docs.attachmate.com/reflection/16-1-1/net-prog-guide/#getstarted.html. The program is located on a remote machine within the same network.

The program works perfectly fine when run on the host computer manually, however when using powershell's 'Invoke-Command' method to remotely run the program, I get the following error message when the remote program calls `MyReflection.CreateApplication(string, bool)`:

`Cannot start the program. Check to ensure Reflection .NET api is enabled'

I've checked the 'Disable .NET api' checkbox and it certainly not is checked. My thoughts were that it could be due to using 'Invoke-Command', but I'm not certain. The powershell script I'm using to invoke this program is (simplified):

 

 

$result = Invoke-Command -Session $session -ScriptBlock { $a = E:\\bin\\myprogram.exe return $a }

 

 

 Any ideas on what I could do to get this working? Either some global configuration to enable the .NET api on 'headless' type users, or if I'm in the wrong ballpark completely!

Thanks in advance


#Reflection14.x
#Reflection

Hi all,

I have created a C# .NET program that performs some automated tasks for us by interfacing with Reflection, using the methods described here https://docs.attachmate.com/reflection/16-1-1/net-prog-guide/#getstarted.html. The program is located on a remote machine within the same network.

The program works perfectly fine when run on the host computer manually, however when using powershell's 'Invoke-Command' method to remotely run the program, I get the following error message when the remote program calls `MyReflection.CreateApplication(string, bool)`:

`Cannot start the program. Check to ensure Reflection .NET api is enabled'

I've checked the 'Disable .NET api' checkbox and it certainly not is checked. My thoughts were that it could be due to using 'Invoke-Command', but I'm not certain. The powershell script I'm using to invoke this program is (simplified):

 

 

$result = Invoke-Command -Session $session -ScriptBlock { $a = E:\\bin\\myprogram.exe return $a }

 

 

 Any ideas on what I could do to get this working? Either some global configuration to enable the .NET api on 'headless' type users, or if I'm in the wrong ballpark completely!

Thanks in advance


#Reflection14.x
#Reflection

Hi Oliver_Mitchell,

I don't know that we are going to be able to help you with using PowerShell to execute this C# .NET program remotely.  You stated that your program works when executed locally.  What happens if you run the  Invoke-Command code locally on that machine using PowerShell?  That might help you to know if it is the command or the fact that you are remote that is causing the issue.  I am not sure how the Windows path is effected by running a .NET application remotely.  Maybe there is something you need to do in order to get the path to .NET into the session.

Regards,

Jeff B


Hi Oliver_Mitchell,

I don't know that we are going to be able to help you with using PowerShell to execute this C# .NET program remotely.  You stated that your program works when executed locally.  What happens if you run the  Invoke-Command code locally on that machine using PowerShell?  That might help you to know if it is the command or the fact that you are remote that is causing the issue.  I am not sure how the Windows path is effected by running a .NET application remotely.  Maybe there is something you need to do in order to get the path to .NET into the session.

Regards,

Jeff B

Hi Jeff,

When running the Invoke-Command command locally it will give the same error message, it seems to be a problem with the fact it will not permit the loading of interactive sessions.

Is there a way to launch Reflection in a non-interactive session?

Thanks,
Oliver

Hi Jeff,

When running the Invoke-Command command locally it will give the same error message, it seems to be a problem with the fact it will not permit the loading of interactive sessions.

Is there a way to launch Reflection in a non-interactive session?

Thanks,
Oliver

The expectation of the Desktop product is that you have a session that the user can interact with.