Forum Discussion
Powershell script is not working using PSF
- Jul 21, 20221) The PsfScriptLauncher.ps1 file is missing from the root of the package. This file is part of the PSF. This file is required as it will be executed in PowerShell to then run your script.
2) The timeout value in the Json is too low. The 10 represents 10ms which is generally not long enough for PowerShell to even start up. Increase to 10000 to get 10 seconds, for example.
3) Add a sleep to the end of the powershell start-sleep 60 would give you time to see any error messages in the PowerShell window should they occur. If so, the timeout value will have to increase more.
4) The Unrestricted option in the json will cause a problem if there is any GPO setting the PowerShell restriction policy. As is in your ps1 file, the Bypass option might be a better choice
5) If you still have issues, use the Sysinternals DebugView tool which can display debugging information emitted by the PsfLauncher as it tries to start your script. Start that tool, then launch the shortcut.
Can you share the package (via messages), the script and manifest file. It will help us debug it deeper.
Thanks
Hi Aniket_Banerjee TIMOTHY_MANGAN
Application Name : Notepad++
Requirement : copying file config.xml (to suppress auto updates)
File Location: $Env:ProgramFiles\WindowsApps\Notepad_1.0.0.0_x64__vwr83xx145m1c\VFS\ProgramFilesX86\Notepad++\config.xml
File Destination : %localappdata%\Packages\Notepad_vwr83xx145m1c\LocalCache\Roaming\Notepad++
==============================
I am trying to copy config.xml file from MSIX package install directory location to users localappdata. the file contains settings to suppress auto update. I did everything required, but not able to succeed to achieve the output. Could you please suggest where I am missing. I have attached config.json, copyfile.ps1, MSIX PSF files pictures, please review.
I followed below link:
https://www.alexandrumarin.com/add-powershell-scripts-in-msix-with-psf/
https://docs.microsoft.com/en-us/windows/msix/psf/run-scripts-with-package-support-framework
https://techcommunity.microsoft.com/t5/msix/notepad-automatic-language-configuration/m-p/3558411
but no luck. please assist.
THANKS in Advance.
- KunalPriv8Aug 07, 2024Copper ContributorHi Siva,
was this resolved?
can you share the PS script if it got success.- Aug 08, 2024There is documentation on using the scripting in my PSF wiki here: https://github.com/TimMangan/MSIX-PackageSupportFramework/wiki/PsfLauncher#scripting
- Jul 20, 2022I believe that the correct path for the copy would be under the package writable root VFS\AppData\Notepad++ folder. But you might be working too hard on that.
The Alex link is about deploying a file based on a runtime decision and therefore must be done with a script. To package up Notepad++ using a static preconfigured file, I copy the file after package installation and use the FileRedirectionFixup to take care of the rest. See https://github.com/TimMangan/App-Info/tree/main/docs/Windows/Notepad++/MainApp- Siva116Jul 20, 2022Brass Contributorthanks for the information, I will try to do that, but my main intension here is to copy a file with powershell script, which is not happening even after doing all. please advise, am I missing anythings?
- Jul 21, 2022So assuming that you are not using the FileRedirectionFixup, I know that if you copied the file into the users normal AppData/Roaming/Notepad++ folder (after creating that folder), the MSIX runtime would redirect that write to the location you are trying to copy to. Maybe try that.
On the other hand, if you included the FRF, you'd copy to the %MSIXWritablePackageRoot%\VFS\AppData\Notepad++ folder instead.