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.
Thanks
# 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 "==============================="
}