nickrod518 / Create-EXEFromPS1

Takes one PowerShell script and any number of supplementary files or even a directory and creates an exe using Windows's built in iexpress program. The exe will run on any machine with PowerShell 2.0+.
94 stars 31 forks source link

Powershell script not found #2

Open ThomasRunting opened 7 years ago

ThomasRunting commented 7 years ago

Ive packaged my ps1 and a supp folder but when the post install cmd runs powershell complains it cant find the ps1 scipt in the correct temp folder. @nickrod518

nickrod518 commented 7 years ago

Can you provide the command you used to create the exe?

ThomasRunting commented 7 years ago
Create-EXEFrom.ps1 -PSScriptPath .\exam-setup.ps1 -SupplementalDirectoryPath .\Scripts\ -x64 -Verbose

It seems like the installer deletes the tmp folder before the post install cmd runs. Iam ussin this on win10 x64 if that helps

nickrod518 commented 7 years ago

So is the missing file error coming from not being able to find exam-setup.ps1, or another script within the .\Scripts\ directory?

ThomasRunting commented 7 years ago

%userprofile%\Temp\IPX000TMP\exam-setup.ps1 %userprofile%\Temp\IPX000TMP\Scripts\"Extra things in here" It deletes the IPX000TMP folder before powershell can find the exam-setup.ps1 file

nickrod518 commented 7 years ago

Very odd, I'm unable to reproduce. I am also on Windows 10 x64. My test was to create a test.ps1 script that pauses after listing doing Get-ChildItem on the supplementary directory. I tried this with and without the -x64 switch. In both cases, the supplementary directory remained until I resumed from the pause, when it was deleted after the script finished.

Can you try using full path names in the command and see if that makes a difference?

How are you able to confirm the temp folder gets created in the first place?

ThomasRunting commented 7 years ago

Ive done some screen caps when i run the finished exe. vid 1 vid 2 vid 3 vlcsnap-2017-05-02-09h18m55s103 you mite need to slow down the vids

nickrod518 commented 7 years ago

That is very odd. So one thing that sticks out is when the CMD window returns "No Instance(s) Available." and then lists the command it runs in the postinstall to initiate the script. Is the tone that comes after from UAC or is there an off-screen error? The only thing I can think of to try is manually recreating that temp folder, move your contents to it, and then try running the CMD in that window to see if some error is returned. Sorry, I don't really have any ideas and can't replicate the issue.

SymmetryInter commented 4 years ago

I know this is a little bit old, but I was able to reproduce this behavior. I was seeing the same thing when the script and supplemental directory were both on a USB flash drive. When performed on a .ps1 and directory that were on an internal drive (literally copied to internal from the flash drive) it worked just fine.