• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
ControlUp Community

ControlUp Community

Connect, Learn, and Grow

  • Blog
  • Archives
  • Findings
  • Meetups
  • Videos
  • Events
  • Categories
    • ControlUp One Platform
    • ControlUp for Apps
    • ControlUp for Compliance
    • ControlUp Dashboards
    • ControlUp for Desktops
    • ControlUp for VDI
    • ControlUp Scripts & Triggers
    • ControlUp Synthetic Monitoring
    • ControlUp Workflows
  • Topics
    • Logos & Wallpaper
    • ControlUp.com
  • Join

Real-Time Output for PowerShell Script Actions

Posted on June 10, 2026

A user asked if it was possible to see live output when running a PowerShell script as a script action. Another user suggested using a function to achieve this, while clarifying that ControlUp Script Actions do not stream output in real time. The first user mentioned seeing live output in other scripts and questioned if it was because they were forcing the output. It was confirmed by another user that this is not the case.


Read the entire ‘Real-Time Output for PowerShell Script Actions’ thread below:

I have a PowerShell script that is a script action, but when I run it I see no live output as its running. Once its finished, then I see the output. In the script I have tried Write-Host and Write-Output, is there another way so that I can see the live output?


yes there is, give me a few minutes and I will get what you need

can you send me the script that you are running? is it a machine or a session script


Session Script. here is the script.

===== Config =====

$diagExe = "C:\Program Files\ProfileUnity[Client.Net](http://Client.Net)\LwL.ProfileUnity.Client.Diagnostic.exe"

$outputShare = "\Servername\Share\LiquidwareDiag"

$logRoot = "C:\Windows\Temp\LiquidwareDiag"

$tempPath = $env:TEMP

$logRoot = Join-Path $tempPath "LiquidwareDiag"

$hostname = $env:COMPUTERNAME

$user = $env:USERNAME

Ensure log directory

if (!(Test-Path $logRoot)) {

New-Item -Path $logRoot -ItemType Directory -Force | Out-Null

}

$logFile = Join-Path $logRoot "$hostname-$user.log"

function Write-Log {

param([string]$Message)

$timestamp = (Get-Date).ToString("yyyy-MM-dd HH:mm:ss")

try {

"$timestamp – $Message" | Out-File -FilePath $logFile -Append -Encoding utf8

} catch {

Write-Logt "LOGGING ERROR: $Message"

}

}

Write-Log "==== Starting Liquidware Diagnostic ===="

Write-Progress "Starting diagnostic for $user on $hostname"

Validate EXE

if (!(Test-Path $diagExe)) {

Write-Log "ERROR: Diagnostic EXE not found"

Write-Host "ERROR: Diagnostic EXE not found"

exit 1

}

$startTime = Get-Date

Write-Log "Start time: $startTime"

Run diagnostic

try {

Write-Log "Launching diagnostic…"

Write-Host "Launching diagnostic"

$proc = Start-Process -FilePath $diagExe -PassThru

Start-Sleep -Seconds 2

# Suppress popup

Get-Process | Where-Object {

$_.ProcessName -like "Diagnostic"

} | ForEach-Object {

try { $_.CloseMainWindow() | Out-Null } catch {}

}

# Don’t rely solely on WaitForExit

Write-Log "Process started, monitoring for output…"

} catch {

Write-Log "ERROR launching diagnostic: $_"

Write-Host "ERROR launching diagnostic"

exit 1

}

Find ZIP

Wait for ZIP file creation (up to 20 minutes)

$timeoutMinutes = 20

$pollIntervalSeconds = 10

Write-Log "Waiting for diagnostic ZIP to be created…"

Write-Host "Waiting for diagnostic to complete (this can take ~15 minutes)…"

$foundFiles = $null

$elapsed = 0

while ($elapsed -lt ($timeoutMinutes * 60)) {

$foundFiles = Get-ChildItem -Path $tempPath -Filter "LwL_ProfileUnity_Client_Diagnostic_*.zip" -ErrorAction SilentlyContinue |

Where-Object { $_.LastWriteTime -ge $startTime }

if ($foundFiles) {

Write-Log "ZIP file detected"

break

}

Write-Host "Still waiting… $([math]::Round($elapsed/60,1)) minutes elapsed"

Start-Sleep -Seconds $pollIntervalSeconds

$elapsed += $pollIntervalSeconds

}

if (!$foundFiles) {

Write-Log "ERROR: Timed out waiting for ZIP file"

Write-Host "ERROR: Timed out waiting for diagnostic ZIP"

exit 1

}

$newFiles = $foundFiles

Write-Output "Found $($newFiles.Count) diagnostic file(s)"

Write-Log "==== Completed ===="

Write-Host "Completed successfully"


ControlUp Script Actions do not stream stdout to the console in real time. Output is collected on the agent during execution and sent to the console only when the script completes. Switching between Write-Host and Write-Output will not change that.


you should be able to do this with a function though

I will test

@member

I know that we have other scripts that are updating during the run, is that only happening because we are forcing it to output


As far as I’m aware, Nazy is spot on.

Continue reading and comment on the thread ‘Real-Time Output for PowerShell Script Actions’.  Not a member? Join Here!


Categories: All Archives, ControlUp Scripts & Triggers
Topics: ControlUp Agent, Logs, Microsoft Windows, PowerShell, Scripts

Ask Us Anything, Connect, Learn, and Grow with the ControlUp Community!

Login to the ControlUp Community to ask us anything, stay up-to-date on what’s new and coming soon and meet other like-minded techies like you.

Not already a member? Join Today!

Primary Sidebar

ControlUp Academy

Enroll in ControlUp Academy for expert-led technical training, equipping you with skills to effectively deploy, manage, and grow your ControlUp investment.

Learn here >

Rotating Images

Hidden Gem from our Community on Slack!

ControlUp Betas - What's Coming Next?
NEW ControlUp Features - Stay Up-to-Date!
ControlUp Scripts - Scripting, Zero to Hero
Latest KB Articles - Be the First to Learn

Video Tutorials Library

Visit our technical how-to videos, offering step-by-step tutorials on advanced features, troubleshooting, and best practices.

Watch here >

ControlUp Blog

Check out the ControlUp blog for expert advice and in-depth analysis.

Read here >

ControlUp Script Library

Visit the ControlUp technical script library, which offers a multitude of pre-built scripts and custom actions for your monitoring and troubleshooting requirements.

See here >

ControlUp Support

Visit the ControlUp support home and to delve deeper into ControlUp DEX solutions.

Browse here >

Footer

      

ControlUp Community
Of Techie, By Techie, For Techie!

Terms of Use | Privacy Policy | Security
Dive Deeper, Learn more at ControlUp.com

  • facebook
  • twitter
  • youtube
  • linkedin

© 2023–2026 ControlUp Technologies LTD, All Rights Reserved.

We use cookies to ensure that we give you the best experience on our website. by continuing to use this site you agree to our Cookie policy..