Activity log not showing output for below worklet.

  • 10 April 2024
  • 3 replies


Hi all, im trying to fetch those system update packages from endpoints. im doing this via this worklet here , for some reason its not showing output in Automox console. can anyone suggest what am i doing wrong here.. i also have same problem for other command Test-PendingReboot -detailed to when i try to verify if endpoint is waiting for a reboot or not..  i also checked out this too and ive tried both standard output stream PowerShell: Write-Output/Write-Host but none of it worked.. just getting an empty box in log summary. Any help would be highly appreciated.





# Check if the PSWindowsUpdate module is installed, if not, install it
if (-not (Get-Module -Name PSWindowsUpdate -ListAvailable)) {
    Install-Module -Name PSWindowsUpdate -Force -AllowClobber -Scope CurrentUser -Repository PSGallery

# Import the PSWindowsUpdate module
Import-Module PSWindowsUpdate

# Get a list of available updates
$updates = Get-WindowsUpdate

# Iterate through each update
foreach ($update in $updates) {
    $title = $update.Title
    $status = $update.InstallationStatus
    $rebootRequired = $update.RebootRequired
    $isDownloading = $update.IsDownloaded
    $isInstalling = $update.IsInstalling
    $errorCode = $update.ErrorCode

    Write-Host "Update Title: $title"

    if ($status -eq "Pending") {
        Write-Host "Status: Waiting to Install"
    } elseif ($status -eq "Downloading") {
        Write-Host "Status: Currently Downloading"
    } elseif ($status -eq "Installing") {
        Write-Host "Status: Currently Installing"
    } elseif ($status -eq "Installed") {
        Write-Host "Status: Installed"
    } elseif ($status -eq "Failed") {
        Write-Host "Status: Failed to Install"
        Write-Host "Error Code: $errorCode"
    } elseif ($status -eq "Error") {
        Write-Host "Status: Error"
        Write-Host "Error Code: $errorCode"

    if ($rebootRequired) {
        Write-Host "Reboot Required: Yes"
    } else {
        Write-Host "Reboot Required: No"

    if ($isDownloading) {
        Write-Host "Downloaded: Yes"
    } else {
        Write-Host "Downloaded: No"

    if ($isInstalling) {
        Write-Host "Installing: Yes"
    } else {
        Write-Host "Installing: No"

    Write-Host "==============================="

3 replies

i believe you have to use Write-Output instead of write-host


@asolorio i did try that. No luck so far.


Userlevel 5
Badge +1

I’d add in a line to catch exceptions if say the cmdlet “Get-WindowsUpdate” returns nothing at all.

IF(!$updates){Write-Output "Did not detect updates"}

You could also do this to see what it might be doing.

Start-Transcript C:\Windows\Temp\Worklet-Code-Test.log

# your worklet code


Get-Content C:\Windows\Temp\Worklet-Code-Test.log

I’m a huge fan of PSExec and launching powershell locally in 32-bit mode to test worklets in real time before dropping them into Automox. Here is the command I’d use for that:

psexec -s -i -d C:\windows\SysWOW64\WindowsPowerShell\v1.0\powershell_ise.exe