Page 3 of 3
Re: Problem executing a PowerShell script using the PowerShell run function
Published: May 3, 2022 - 4:04 PM
by Albin
Hello,
Yes, that is indeed the name of my package.
I ran the command: `wapt-get session-setup Printer -f` and I got this result
: `Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
Configuring Printer ...
Done`.
It indicates the package configuration is complete, but the change is not being applied to my machine.
Regards,
Albin,
Re: Problem executing a PowerShell script using the PowerShell run function
Published: May 3, 2022 - 4:12 PM
by sfonteneau
In a cmd (in
NO (administrator) you can launch:
Code: Select all
powershell.exe -executionpolicy bypass c:\test.ps1
To check if the problem isn't with run_powershell_from_file
Re: Problem executing a PowerShell script using the PowerShell run function
Published: May 3, 2022 - 4:18 PM
by Albin
I ran the command: powershell.exe -executionpolicy bypass c:\testwapt.ps1 and the change was successfully applied to my machine.
Regards,
Albin
Re: Problem executing a PowerShell script using the PowerShell run function
Published: May 3, 2022 - 4:38 PM
by sfonteneau
To run the test again:
Can you change the package code to:
Code: Select all
# -*- coding: utf-8 -*-
from setuphelpers import *
def install():
filecopyto('testwapt.ps1',r'c:\testwapt.ps1')
def session_setup() :
print('configure imprimante')
print(run_powershell_from_file(r"c:\testwapt.ps1",output_format="text"))
restart the installation of the wapt package
And finally, restart the command:
Code: Select all
wapt-get session-setup Imprimante -f
With the return
We just did an internal test here and it works for us
Re: Problem executing a PowerShell script using the PowerShell run function
Published: May 4, 2022 - 12:18 PM
by Albin
Hello,
I ran the script in question.
After the script ran, I executed the command `wapt-get session-setup Printer -f` as requested.
Unfortunately, I had to restart my computer for it to work. Is this normal?
Is it possible to run the script without having to execute the command mentioned above (`wapt-get session-setup Printer -f`)?
Thank you in advance for your reply,
Best regards,
Albin
Re: Problem executing a PowerShell script using the PowerShell run function
Published: May 4, 2022 - 1:38 PM
by sfonteneau
The session-setup runs automatically when a session is opened.
It also runs automatically in sessions opened after each installation launched via the console.
However, in debug mode (PyScripter and package development), the session-setup must be run manually.
Note that the session-setup runs only once per package version for each session!
Re: Problem executing a PowerShell script using the PowerShell run function
Published: May 4, 2022 - 2:51 PM
by Albin
Thank you so much for your help