Deploying a package containing a PowerShell script
Published: June 23, 2020 - 1:05 PM
Good morning,
Having little experience in preparing packages other than MSI/EXE or MSU, I am stuck on deploying a few lines of PowerShell.
Here is my setup.py file:
When I deploy the package to a machine, I get the following error:
Do you have any idea where the problem might be coming from?
Do you have any example files containing PowerShell scripts?
Thank you in advance!
Having little experience in preparing packages other than MSI/EXE or MSU, I am stuck on deploying a few lines of PowerShell.
Here is my setup.py file:
Code: Select all
# -*- coding: utf-8 -*-
from setuphelpers import *
def install():
run_powershell(Get-NetIPInterface | where {$_.InterfaceAlias -eq "Wi-Fi"} | Set-NetIpInterface -InterfaceMetric 45)
run_powershell(Get-NetIPInterface | where {$_.InterfaceAlias -match"Local"} | Set-NetIpInterface -InterfaceMetric 10)
run_powershell(Get-NetIPInterface | where {$_.InterfaceAlias -match "Ethernet"} | Set-NetIpInterface -InterfaceMetric 10)Code: Select all
Traceback (most recent call last):
File "C:\Program Files (x86)\wapt\common.py", line 3807, in install_wapt
setup = import_setup(setup_filename)
File "C:\Program Files (x86)\wapt\waptutils.py", line 1383, in import_setup
py_mod = imp.load_source(modulename, setupfilename.encode(sys.getfilesystemencoding()))
File "c:\windows\temp\wapt_p5e60\setup.py", line 6
run_powershell(Get-NetIPInterface | where {$_.InterfaceAlias -eq "Wi-Fi"} | Set-NetIpInterface -InterfaceMetric 45)
^
SyntaxError: invalid syntax
SyntaxError: invalid syntax (setup.py, line 6)Do you have any example files containing PowerShell scripts?
Thank you in advance!