I have version 5.6.162, every time I build a ps1 file in exe, by configuring Script Engines "Powershell 5", when I start the executable, on each line of write-host there is always the following writing:
Preparing modules for first use.
Preparing modules for first use.
Preparing modules for first use.
can you please tell me how you can eliminate this bug?
BUG BUILDING EXE WITH SCRIPT ENGINE POWERSHELL 5
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.
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.
- mxtrinidad
- Posts: 399
- Last visit: Tue May 16, 2023 6:52 am
Re: BUG BUILDING EXE WITH SCRIPT ENGINE POWERSHELL 5
Can you please provide a sample script of what you considered is a bug? I will help understand the issue you're experiencing.
- Alexander Riedel
- Posts: 8488
- Last visit: Tue Apr 16, 2024 8:42 am
- Been upvoted: 37 times
Re: BUG BUILDING EXE WITH SCRIPT ENGINE POWERSHELL 5
The message 'Preparing modules for first use.' is a Powershell message that stems from auto-loading custom modules.
Examine your script for modules used and load them explicitly on startup. That usually helps the problem.
Please understand that this is powershell output and has nothing to do with the packager.
A quick Google search shows a similar issue here: https://stackoverflow.com/questions/447 ... sage-stuck
Examine your script for modules used and load them explicitly on startup. That usually helps the problem.
Please understand that this is powershell output and has nothing to do with the packager.
A quick Google search shows a similar issue here: https://stackoverflow.com/questions/447 ... sage-stuck
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: BUG BUILDING EXE WITH SCRIPT ENGINE POWERSHELL 5
This a sample, but in more complex script "Preparing modules for first use." appear frequently during script execution.
try build this simple code with ps5 engine configuration
---------------------------
cls
$startdate = (Get-Date 06/02/2020)
$enddate = (Get-Date 06/02/2021)
$avviso = '15'
$notifydate = (Get-Date $enddate).AddDays(- $avviso)
$today = (Get-Date)
$enddateformat = ($enddate).ToString('dd/MM/yyyy')
IF ($today -ge $startdate -and $today -le $enddate) {
Write-Host -ForegroundColor Green "Run script"
}
Start-Sleep 3
try build this simple code with ps5 engine configuration
---------------------------
cls
$startdate = (Get-Date 06/02/2020)
$enddate = (Get-Date 06/02/2021)
$avviso = '15'
$notifydate = (Get-Date $enddate).AddDays(- $avviso)
$today = (Get-Date)
$enddateformat = ($enddate).ToString('dd/MM/yyyy')
IF ($today -ge $startdate -and $today -le $enddate) {
Write-Host -ForegroundColor Green "Run script"
}
Start-Sleep 3
- Alexander Riedel
- Posts: 8488
- Last visit: Tue Apr 16, 2024 8:42 am
- Been upvoted: 37 times
Re: BUG BUILDING EXE WITH SCRIPT ENGINE POWERSHELL 5
Does not display any such message.
- Attachments
-
- preparetest.exe.zip
- (156.62 KiB) Downloaded 195 times
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: BUG BUILDING EXE WITH SCRIPT ENGINE POWERSHELL 5
Your tests are not going well.
I talked about compiling the script in EXE format and running it, that's the problem.
If you use my same version of PS studio you will see that the problem occurs.
I talked about compiling the script in EXE format and running it, that's the problem.
If you use my same version of PS studio you will see that the problem occurs.
- Alexander Riedel
- Posts: 8488
- Last visit: Tue Apr 16, 2024 8:42 am
- Been upvoted: 37 times
Re: BUG BUILDING EXE WITH SCRIPT ENGINE POWERSHELL 5
What do you mean my tests are not going well? It's not a compiler. It just runs powershell in a host on your machine.
I packaged with the same packager you use and the code you provided.
Run the exe I packaged here on YOUR machine and see what it does.
I packaged with the same packager you use and the code you provided.
Run the exe I packaged here on YOUR machine and see what it does.
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: BUG BUILDING EXE WITH SCRIPT ENGINE POWERSHELL 5
Look at my first post, you have to publish with that specific configuration otherwise you will never see that error.
Provided that you have my same version ..
I can not send exe files here in the forum so you have to test it, what you did is not good.
Provided that you have my same version ..
I can not send exe files here in the forum so you have to test it, what you did is not good.
- Alexander Riedel
- Posts: 8488
- Last visit: Tue Apr 16, 2024 8:42 am
- Been upvoted: 37 times
Re: BUG BUILDING EXE WITH SCRIPT ENGINE POWERSHELL 5
Ok, I am gonna break this to you as gentle as I can.
I wrote the packager code and the code for the hosts, so chances are, I do know a little bit more about it than you. So instead of telling me that what I do is no good, how about you follow my lead here.
I packaged your code with a Windows host and a command line host, the latter being what you have shown in your screenshot. That is what you see in the screenshots I posted that you just dismissed as “no good”. The engine selection is all you have shown, so I cannot possible use your exact configuration because you have not provided that. If you did anything special there you should provide that.
Additionally, I have attached a zip file with a packaged exe to my response with the screenshots. I can see you have not downloaded it yet, so you should maybe do that.
I also asked you to run that on your machine to see what it does.
That is to determine if the packaging is at fault or your local configuration.
Your turn.
I wrote the packager code and the code for the hosts, so chances are, I do know a little bit more about it than you. So instead of telling me that what I do is no good, how about you follow my lead here.
I packaged your code with a Windows host and a command line host, the latter being what you have shown in your screenshot. That is what you see in the screenshots I posted that you just dismissed as “no good”. The engine selection is all you have shown, so I cannot possible use your exact configuration because you have not provided that. If you did anything special there you should provide that.
Additionally, I have attached a zip file with a packaged exe to my response with the screenshots. I can see you have not downloaded it yet, so you should maybe do that.
I also asked you to run that on your machine to see what it does.
That is to determine if the packaging is at fault or your local configuration.
Your turn.
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: BUG BUILDING EXE WITH SCRIPT ENGINE POWERSHELL 5
I send you the screenshots and the executable so you can understand better.
- Attachments
-
- test 2.zip
- (49.8 KiB) Downloaded 227 times