The search returned 8 results

by swbsf
August 4, 2017 - 11:20
Forum: WAPT Packages
Subject: [Solved] session-setup still launches powershell in 32-bit mode
Answers: 3
Views : 4659

Re: session-setup always launches PowerShell in 32-bit mode

Okay, I'll do the questions and answers then ;)
The answer was found here: https://stackoverflow.com/a/23395020/3829020
Sneaky little Windows!
To make a long story short, if we look for the process in System32, this directory is virtualized for 32-bit processes (in this case, Python), so we...
by swbsf
August 4, 2017 - 11:02
Forum: WAPT Packages
Subject: [Solved] session-setup still launches powershell in 32-bit mode
Answers: 3
Views : 4659

Re: session-setup always launches PowerShell in 32-bit mode

The noose is tightening!

Code: Select all

    >>> run(u'c:\\Windows\\System32\\WindowsPowershell\\v1.0\\powershell.exe -Command "[Environment]::Is64BitProcess"')
    <RunOuput returncode :0>
    u'False\r\n'
by swbsf
August 4, 2017 - 10:57
Forum: WAPT Packages
Subject: [Solved] session-setup still launches powershell in 32-bit mode
Answers: 3
Views : 4659

[Solved] session-setup still launches powershell in 32bits

Hello,
I admit this is quite convoluted, so I'm turning to you to see if anyone has any insights :)

My PowerShell script:

`$ErrorActionPreference="SilentlyContinue"
Stop-Transcript | out-null
$ErrorActionPreference="Continue"
Start-Transcript -path c:\tmp\Win10.log -append

if ...`
by swbsf
August 4, 2017 - 10:25
Forum: WAPT Packages
Subject: PC shuts down before scripts finish
Answers: 4
Views : 4338

Re: PC shuts down before scripts finish

Hi,
I'm successfully using:
`cmd="c:\\Windows\\System32\\WindowsPowershell\\v1.0\\powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -File c:\\tmp\\Win10.ps1"`
`proc = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE)`
`proc.wait()

` The `proc.wait()` command works correctly in my...
by swbsf
August 1, 2017 - 09:27
Forum: WAPT Packages
Subject: [SOLVED] run(powershell script.ps1) timeout
Answers: 4
Views : 5290

Re: run(powershell script.ps1) timeout

Okay, I'm taking back what I said. The error was indeed related to the PowerShell version being less than 3.0. On one hand, it was PS 2.0, and on the other, just a slow machine, so the timeout of 3 was too short to run a simple PS command.
Thank you for your detailed help :)
by swbsf
July 31, 2017 - 09:01
Forum: WAPT Packages
Subject: [SOLVED] run(powershell script.ps1) timeout
Answers: 4
Views : 5290

Re: run(powershell script.ps1) timeout

It's Windows 10, so yes.

Code: Select all

    PS C:\Windows\system32> $PSVersionTable.PSversion
     
    Major  Minor  Build  Revision
    -----  -----  -----  --------
    5      0      10586  122
by swbsf
July 27, 2017 - 11:44
Forum: WAPT Packages
Subject: [SOLVED] run(powershell script.ps1) timeout
Answers: 4
Views : 5290

Re: run(powershell script.ps1) timeout

For your information, the problem is circumvented with a:

Code: Select all

import subprocess
cmd="powershell -NoProfile -NonInteractive -File c:\\tmp\\test.ps1"
proc = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE)
proc.wait()
stdo,stde = proc.communicate()
print(stdo,stde)
by swbsf
July 27, 2017 - 10:05
Forum: WAPT Packages
Subject: [SOLVED] run(powershell script.ps1) timeout
Answers: 4
Views : 5290

[SOLVED] run(powershell script.ps1) timeout

Hello,
I'm trying my luck here.
I'm creating a post-installation package that will configure workstations by running a PowerShell script. So, to answer a potential question of "why am I not doing this post-installation in pure Python?" right away: because I already have the script in...