Powershell Script to EXE error

I am using Visual studio Code with Powershell Pro Tools

Everything packages like it should.

One line of of the script continues to throw an error.

Get-RDUserSession : The term ‘Get-RDUserSession’ is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At line:3986 char:28

  •         $ShadowInfo3 = Get-RDUserSession -ConnectionBroker $GW3 | ...
    
  •                        ~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ObjectNotFound: (Get-RDUserSession:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

However, if I use v5.4.3 of the tools with DotNetVersion = ‘v4.6.2’
. The entire script works as intended.

Thus far I have tried the following newer versions
5.9.0
5.10
5.11.0
5.12.5
5.12.6

I have also tried using DotNetVersion 4.8, 4.7.2 same thing
v5.4.3 will work but not any other version I have tried thus far.

Any assistance would be greatly appreciated.

Can you send me a version you compile with 5.4.3 and one with later versions? I can investigate what’s different.

Not sure if this matters, but have you tried changing the Platform setting in the package config? https://docs.poshtools.com/powershell-pro-tools-documentation/packaging/package.psd1#config-file-schema

I have not tried the platform setting. I am more than happy to give it a go. In my package.psd1 I do not have that listed.

Edit: Just tried the platform setting x64 and low and behold. It appears to be working with latest v5.12.8

I very much appreciate the quick response.

1 Like