I'm fairly new to VB programming but I have some code that I can execute on my local machine and it works fine however I'm trying execute the code on a remote machine. If I use remote desktop to logon to the remote machine and then run the exe it works fine but I would like to execute the code through powershell so I don't have to use remote desktop. in powershell I use the following command to get onto the remote machine

Enter-PSSession -ComputerName

once on the remote machine I run the exe the same as I would if I were using remote desktop. This gives me the error cannot create activex component. An abreviated version of the code that I'm trying to execute is

Public Class Form1
Public feApp As femap.model

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load


feApp = CreateObject("femap.model")
Catch ex As Exception
End Try

'do some stuff here


End Sub
End Class

running this code through powershell on the remote machine gives me the following output

System.Exception: Cannot create ActiveX component.
at Microsoft.VisualBasic.Interaction.CreateObject(String ProgId, String ServerName)
at FeBDFParse.Form1.Form1_Load(Object sender, EventArgs e)

Since this same code works just fine when I have a graphics session up through remote desktop I'm thinking it has something to do with a library or something that isn't being loaded when you are just going through powershell. Is there anything I can do to troubleshoot this more or is it obvious that I need to run some command prior to my code to make the createobject function work?

Thanks for any help