Author Posts

July 7, 2015 at 1:49 pm

Hi

I am trying to execute a native ( db2 ) command on couple of remote servers.
The actual command is "db2diag -A"
When I execute the command from remote desktop the command runs successful.
But when I run it via script block on Invoke-Command or PSSession, the tool ends without any error or warnings.

I was able to confirm that the native command is invoked using process monitor. I have been able to successfully execute other utilities from DB2 but not this one.

I read the gotchas on certain functions that depend on user profile not being available in remoting, but I am hoping that is not the case here, considering the tool is just rotating the logs.

Any suggestions on how to diagnose this further or resolve this issue?
Appreciate your support

July 7, 2015 at 1:58 pm

Unfortunately, there might not be a satisfactory resolution.

It's possible that the tool requires a full user profile, which Remoting doesn't provide.

It's also possible that the tool isn't using stdin/stdout, which means it's running, but you have no way to interact with it.

Neither of those can be resolved without rewriting the tool, but one of those is a likely cause. PowerShell can only do so much when it comes to external commands.

July 7, 2015 at 2:13 pm

Thank you Don for your thoughts. I will follow-up with the vendor on this.

Would you have any pointers to resources on this – to determine if the executable indeed requires a full user logon session or any diagnostic tools that might provide additional insight? I understand this could be out of scope, just checking.

July 7, 2015 at 2:31 pm

There's no way to tell without looking at its source code, really.

July 11, 2015 at 1:10 am

Hi J2ag,

Just out of interest, how are you running the executable via PowerShell? Also, are you referring to the absolute path when running the executable, changing to it's location first, or is it pathed?