Interactive Execution as SYSTEM Fails to Launch in Visible Session
Title: Interactive Execution as SYSTEM Fails to Launch in Visible Session
Description:
When attempting to run a script interactively as SYSTEM using Invoke-CommandAs, the task fails to run in a visible interactive session. Despite using the -AsInteractive parameter with 'SYSTEM', the script executes in the background and is not presented interactively on the desktop.
Steps to Reproduce:
-
Import the
Invoke-CommandAsmodule. -
Attempt to run a PowerShell script interactively as SYSTEM:
Invoke-CommandAs -ScriptBlock { & "C:\path\to\script.ps1" } -AsInteractive 'SYSTEM' -
Observe that the script runs but is not visible in the interactive session.
Expected Behavior: The script should execute interactively, allowing user interaction with the console window or any UI components presented by the script.
Actual Behavior: The script runs in the background, with no interactive session presented on the desktop.
Environment Details:
- OS: Windows 10/11
- PowerShell Version: 5.1
- Invoke-CommandAs Version: Latest (v3.1.9)
- Script: Any PowerShell script (e.g., a PSAppDeployToolkit script or a basic console interaction)
Additional Context:
- Running the same script manually or using other interactive SYSTEM methods (e.g., via Task Scheduler with "Allow interaction with desktop") works as expected.
- I also attempted using
-AsSystemand-AsUser, but only-AsInteractive 'SYSTEM'seems to fail to launch in an interactive session.
Please let me know if there are any additional flags or methods to ensure interactive execution as SYSTEM, or if this could be a potential bug with the module.
Let me know if you'd like any changes before submitting it!
Are you able to replicate the interactive SYSTEM method using powershell manually?
Closed due to inactivity