PowerShell studio output issue.

Use this forum to ask questions before you buy. Need information on licensing or pricing? Questions about a trial version? This is the right place for you. No scripting questions, please.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
User avatar
m.elsayaad
Posts: 5
Joined: Sat May 07, 2016 2:45 am

PowerShell studio output issue.

Post by m.elsayaad » Tue May 23, 2017 12:12 pm

Hello there,
I have an abnormal behavior in PowerShell Studio 2017 v5.4.136

If I created empty project contains the following in startup.pss which (should print simple text only)

#Define a Param block to use custom parameters in the project
#Param ($CustomParameter)

function Main {
<#
.SYNOPSIS
The Main function starts the project application.

.PARAMETER Commandline
$Commandline contains the complete argument string passed to the script packager executable.

.NOTES
Use this function to initialize your script and to call GUI forms.

.NOTES
To get the console output in the Packager (Forms Engine) use:
$ConsoleOutput (Type: System.Collections.ArrayList)
#>
Param ([String]$Commandline)

Write-Host 'Hello, this is empty project'
Read-Host



$script:ExitCode = 0 #Set the exit code for the Packager
}

When build the project and copy the exe file to another machine with windows 8.1 embedded

I got the error before print text (as attached)

The paths mentioned in the errors comes from the machine that produced the exe file.

Also the strange is that the exe comes from empty project not related to any files or paths.

The exe should print simple text “Hello, this is empty project”

I need to know what is going on and why I got this errors in all exe files I created.

Although I tried PowerGUI to generate exe do the same thing (print text) and it worked fine.

I tried more than machine with windows 8.1 embedded and have the same issue.

Waiting for your feedback.

Thanks.
Attachments
PowerShellStudioIssue.png
Screenshot with issue
PowerShellStudioIssue.png (47.02 KiB) Viewed 11089 times

User avatar
Alexander Riedel
Posts: 7021
Joined: Tue May 29, 2007 4:43 pm

Re: PowerShell studio output issue.

Post by Alexander Riedel » Tue May 23, 2017 1:12 pm

[Moved to correct forum by moderator]
To ensure faster service please make sure to post in the appropriate forum. The Customer service forum is for non-technical customer support issues.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
Alexander Riedel
Posts: 7021
Joined: Tue May 29, 2007 4:43 pm

Re: PowerShell studio output issue.

Post by Alexander Riedel » Tue May 23, 2017 1:17 pm

I am not sure what you are packaging here. The code you posted does not contain any reference to LoadFile or the files name it complains about, so it is pretty obvious that you include other files in your project.
If you just want to package a simple script, you do not need a project, you can just package the script directly.
Maybe you can elaborate on what you are trying to do.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
m.elsayaad
Posts: 5
Joined: Sat May 07, 2016 2:45 am

Re: PowerShell studio output issue.

Post by m.elsayaad » Wed May 24, 2017 1:25 am

Thanks Alexander for your reply.

actually i need to package a project with files, but the project doesn't contain any reference to LoadFile function or the files name mentioned in the error.
i tried this simple script to make sure that the issue is not related to files in my package.
This is only a sample for packaging not what i need to do.

I wonder if there is something saved in PowerShell studio itself that keep loading script what ever the project package ?!

User avatar
m.elsayaad
Posts: 5
Joined: Sat May 07, 2016 2:45 am

Re: PowerShell studio output issue.

Post by m.elsayaad » Wed May 24, 2017 2:04 am

I think i found the root cause of this issue, but i couldn't fix it!!!

when i exported the script to file i found section for Import assemblies which i didn't added in my new project.

i may added these assemblies before for another projects but not for this one.

i think i was right when i thought there is something saved in powershell studio it self and always loaded for new projects.

here the script file, can you tell me how to remove these section from my project?


#------------------------------------------------------------------------
# Source File Information (DO NOT MODIFY)
# Source ID: d7753f6c-7b13-48d4-90fd-176e36bcf505
# Source File: TestPowerShellExe.psproj
#------------------------------------------------------------------------
#region Project Recovery Data (DO NOT MODIFY)
<#RecoveryData:#>
#endregion
<#
.NOTES
--------------------------------------------------------------------------------
Code generated by: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.136
Generated on: 24/May/17 10:57 AM
Generated by: m.elsayaad
Organization: Vytru
--------------------------------------------------------------------------------
.DESCRIPTION
Script generated by PowerShell Studio 2017
#>



#region Source: Startup.pss
#region File Recovery Data (DO NOT MODIFY)
<#RecoveryData:#>
#endregion
#----------------------------------------------
#region Import Assemblies
#----------------------------------------------
[void][Reflection.Assembly]::Load('System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][Reflection.Assembly]::Load('System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][Reflection.Assembly]::Load('System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
[void][Reflection.Assembly]::Load('Licensing.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null')
[void][Reflection.Assembly]::Load('log4net, Version=1.2.11.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a')
[void][Reflection.Assembly]::Load('LogicNP.CryptoLicensing, Version=3.0.0.0, Culture=neutral, PublicKeyToken=4a3c0a4c668b48b4')
[void][Reflection.Assembly]::Load('Vytru.Helpers, Version=1.0.5463.28953, Culture=neutral, PublicKeyToken=null')

[void][Reflection.Assembly]::Load('System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
#endregion Import Assemblies

#Define a Param block to use custom parameters in the project
#Param ($CustomParameter)

function Main {
<#
.SYNOPSIS
The Main function starts the project application.

.PARAMETER Commandline
$Commandline contains the complete argument string passed to the script packager executable.

.NOTES
Use this function to initialize your script and to call GUI forms.

.NOTES
To get the console output in the Packager (Forms Engine) use:
$ConsoleOutput (Type: System.Collections.ArrayList)
#>
Param ([String]$Commandline)

Write-Host 'Hello, this is empty project'

Read-Host


$script:ExitCode = 0 #Set the exit code for the Packager
}
#endregion Source: Startup.pss

#Start the application
Main ($CommandLine)

User avatar
Alexander Riedel
Posts: 7021
Joined: Tue May 29, 2007 4:43 pm

Re: PowerShell studio output issue.

Post by Alexander Riedel » Wed May 24, 2017 2:20 am

Click on the assemblies button on the ribbon (Edit panel, Home tab) and remove the assembly reference you do not want to be present.
Adding assemblies to one project does not make them a default for other or new projects. Did you copy the project from someplace else?
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
m.elsayaad
Posts: 5
Joined: Sat May 07, 2016 2:45 am

Re: PowerShell studio output issue.

Post by m.elsayaad » Wed May 24, 2017 2:32 am

it is now working fine thanks Alexander.
Alexander Riedel wrote:Click on the assemblies button on the ribbon (Edit panel, Home tab) and remove the assembly reference you do not want to be present.
Adding assemblies to one project does not make them a default for other or new projects. Did you copy the project from someplace else?
no i didn't copy this project from someplace else, but my original project yes.

i found the same files included in file > options > Assemblies tab
i think these was a default assemblies loaded to all new projects.
i don't know how these assemblies are loaded there or when, but i removed them too.

thanks again for your fast support :)

have a good day.