Good afternoon!
I have a fairly strong grasp of Powershell itself, but I cannot for the life of me figure out how to get a standalone exe to work using deployment (primarily because I don't have experiences building packages. Does anyone have resources I can look into to educate myself on this?
Deployment N00b!
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This forum is a space to discuss coding in PowerShell, and technical issues related to development.
- Question about a licensed SAPIEN product? Post here: Product Support for Registered Users
- Question about a trial SAPIEN product? Post here: Former and Future Customers - Questions
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This forum is a space to discuss coding in PowerShell, and technical issues related to development.
- Question about a licensed SAPIEN product? Post here: Product Support for Registered Users
- Question about a trial SAPIEN product? Post here: Former and Future Customers - Questions
Deployment N00b!
I am sure you realized that the files don't actually exist in the folders indicated. The executable resulting from packaging is not created in the same folder as your original script. So you have to copy/move any auxiliary files relative to where the executable is.
https://www.sapien.com/blog/2009/09/02/ ... nvocation/ may help you locate the location of your application whether it is a script or packaged.
Depending on your needs, the data requiring to be modified during application sessions or not, it might be advisable to place your data in a location that is easily 'calculated' by either script or packaged executable.
For Example:
C:\ProgramData\<Your Application>\User Account Tools\Common
might be a good location.
If your data is per user rather than per machine
C:\Users\<User>\AppData\Roaming\<Your Application>\User Account Tools\Common
would be a better choice
Go to full posthttps://www.sapien.com/blog/2009/09/02/ ... nvocation/ may help you locate the location of your application whether it is a script or packaged.
Depending on your needs, the data requiring to be modified during application sessions or not, it might be advisable to place your data in a location that is easily 'calculated' by either script or packaged executable.
For Example:
C:\ProgramData\<Your Application>\User Account Tools\Common
might be a good location.
If your data is per user rather than per machine
C:\Users\<User>\AppData\Roaming\<Your Application>\User Account Tools\Common
would be a better choice
Re: Deployment N00b!
I would suggest clicking the link in PSS for the documentation and reading how the builder and deployer work which will give you all of the options available and fair explanation of how to build and deploy an EXE with examples.
Read the following carefully and do the examples. https://info.sapien.com/manuals/powersh ... ckage.html
Once you see it it is very simple and easy.
Read the following carefully and do the examples. https://info.sapien.com/manuals/powersh ... ckage.html
Once you see it it is very simple and easy.
Re: Deployment N00b!
I managed to get an exe file, but it doesn't seem to be able to see my module & supporting files. I did check the option for 'resolve and include external scripts'. What else am I missing here?
- Alexander Riedel
- Posts: 8615
- Last visit: Tue Jan 21, 2025 3:46 pm
- Been upvoted: 45 times
Re: Deployment N00b!
You will have to be more specific. External scripts means dot sourced scripts. Modules cannot be resolved and packaged, that would defeat the purpose of a module. Not sure what you mean by it cannot 'see' them.
Generally, it is best to provide the code you use to access something and the resulting error message.
Generally, it is best to provide the code you use to access something and the resulting error message.
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Deployment N00b!
Here is the errors produced when attempting to run the executable:
Here's the section of code where it's failing:
- Get-Content:
- Line |
- 72 | … bal:FacilityInfo = Get-Content .\Common\FacilityMappings.json | Conve …
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- | Cannot find path 'C:\Users\amclay\Documents\SAPIEN\PowerShell Studio\Projects\User Account Tools\bin\x64\User Account Tools\Common\FacilityMappings.json' because it does not exist.
- Get-Content:
- Line |
- 73 | $Global:UATSettings = Get-Content .\Common\Settings.json | Conver …
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- | Cannot find path 'C:\Users\amclay\Documents\SAPIEN\PowerShell Studio\Projects\User Account Tools\bin\x64\User Account Tools\Common\Settings.json' because it does not exist.
- Import-Module:
- Line |
- 76 | Import-Module .\Common\UserToolsFunctions.psm1 -Force
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- | The specified module '.\Common\UserToolsFunctions.psm1' was not loaded because no valid module file was found in any module directory.
- $Global:FacilityInfo = Get-Content .\Common\FacilityMappings.json | ConvertFrom-Json
- $Global:UATSettings = Get-Content .\Common\Settings.json | ConvertFrom-Json
- Import-Module .\Common\UserToolsFunctions.psm1 -Force
- Alexander Riedel
- Posts: 8615
- Last visit: Tue Jan 21, 2025 3:46 pm
- Been upvoted: 45 times
Re: Deployment N00b!
I am sure you realized that the files don't actually exist in the folders indicated. The executable resulting from packaging is not created in the same folder as your original script. So you have to copy/move any auxiliary files relative to where the executable is.
https://www.sapien.com/blog/2009/09/02/ ... nvocation/ may help you locate the location of your application whether it is a script or packaged.
Depending on your needs, the data requiring to be modified during application sessions or not, it might be advisable to place your data in a location that is easily 'calculated' by either script or packaged executable.
For Example:
C:\ProgramData\<Your Application>\User Account Tools\Common
might be a good location.
If your data is per user rather than per machine
C:\Users\<User>\AppData\Roaming\<Your Application>\User Account Tools\Common
would be a better choice
https://www.sapien.com/blog/2009/09/02/ ... nvocation/ may help you locate the location of your application whether it is a script or packaged.
Depending on your needs, the data requiring to be modified during application sessions or not, it might be advisable to place your data in a location that is easily 'calculated' by either script or packaged executable.
For Example:
C:\ProgramData\<Your Application>\User Account Tools\Common
might be a good location.
If your data is per user rather than per machine
C:\Users\<User>\AppData\Roaming\<Your Application>\User Account Tools\Common
would be a better choice
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Deployment N00b!
I finally have it figured out, I stopped trying to run the exe from bin and used a MSI installer to install everything to program files.
Some functions in my scripts are behaving differently than they do in the editor, but that's a problem for a different thread.
Thank you all for your assistance!
Some functions in my scripts are behaving differently than they do in the editor, but that's a problem for a different thread.
Thank you all for your assistance!