Article ID: 111250, created on May 9, 2011, last review on May 11, 2014

  • Applies to:
  • Virtuozzo hypervisor 4.0
  • Virtuozzo hypervisor 5.0


When you use prlctl exec command to run powershell commands inside a VE, the session is not closed automatically.

For example:

# prlctl exec VE_NAME powershell Set-ExecutionPolicy Unrestricted

When issuing the above command one has to press CRTL+C to exit out of the powershell session. However, when running this same command from the command prompt directly in the guest environment, powershell exits as soon as the command finishes executing.


There is no clear proof, but it looks like there is a bug in powershell itself. It erroneously wants to read from stdin even when run non-interactively.


You can input NUL to the script or command using cmd.exe. 

Run a command:
prlctl exec VE_NAME 'cmd /c powershell.exe -Command dir variable: >> c:\\command\\input.out < NUL'

Run a script:
prlctl exec VE_NAME 'cmd /c powershell.exe -File c:\\command\\input.ps1 < NUL'

Note: Do not forget to replace VE_NAME with the actual virtual machine name.

c662da62f00df94fd77ba7a2c9eff4b4 a26b38f94253cdfbf1028d72cf3a498b d245cfd276e66749824316e20bfd8ade 2897d76d56d2010f4e3a28f864d69223

Email subscription for changes to this article
Save as PDF