Hello @touqeeranjum
Did u try PoshProgressBar ?
# Install the PoshProgressBar module
Install-Module -Name PoshProgressBar -Scope CurrentUser -Force
# Import the PoshProgressBar module
Import-Module PoshProgressBar
# Set the path to the update package
$updatePackage = "C:\path\to\update_package.msu"
# Get the size of the update package
$totalSize = (Get-Item $updatePackage).Length
# Calculate the download speed by measuring the time it takes to download a test file
$testFile = "https://example.com/testfile.txt"
$testFileSize = (Invoke-WebRequest $testFile).Content.Length
$testTime = Measure-Command { Invoke-WebRequest $testFile -OutFile "testfile.txt" }
$downloadSpeed = $testFileSize / $testTime.TotalSeconds
# Create a progress bar object
$progressBar = New-ProgressBar -Title "Updating Windows" -Maximum 100 -Width 50
# Download the update package silently
Start-BitsTransfer -Source $updatePackage -Destination $env:TEMP
$downloadSize = 0
$remainingSize = $totalSize - $downloadSize
# Update the progress bar and estimated time remaining
while ($downloadSize -lt $totalSize) {
$progressBar.Value = ($downloadSize / $totalSize) * 100
$remainingTime = New-TimeSpan -Seconds ($remainingSize / $downloadSpeed)
$remainingTimeString = $remainingTime.ToString("hh\:mm\:ss")
$progressBar.Message = "Time remaining: $remainingTimeString"
Update-ProgressBar $progressBar
# Wait for a short period to avoid excessive updates to the progress bar
Start-Sleep -Seconds 1
# Get the size of the downloaded file and update the progress bar and estimated time remaining
$downloadedFile = Join-Path $env:TEMP (Split-Path $updatePackage -Leaf)
$downloadedSize = (Get-Item $downloadedFile).Length
$downloadSize = $downloadedSize
$remainingSize = $totalSize - $downloadSize
}
# Install the update package silently
wusa.exe $downloadedFile /quiet /norestart
# Verify that the update was installed successfully
$progressBar.Value = 100
$progressBar.Message = "Verifying update..."
Update-ProgressBar $progressBar
# TODO: Add code to verify the update
# Complete the progress bar and exit the script
$progressBar.Message = "Update complete!"
Complete-ProgressBar $progressBar
I hope this is work for u.
Regards