Incompatibility between Get-WebApplication and Write-Progress?

Ben Van Doorsselaere 1 Reputation point
2021-04-09T06:59:47.563+00:00

I can’t seem to find a reason, so I hope you can shine a light.
Following code doesn’t execute the second write-progress.
The output for get-webapplication is shown in my receive-job, so the command executes correctly.
I can execute other commands after the get-webapplication and they work fine as well.
But not write-progress

If I change the get-webapplication to get-process, then everything works ok.
Why does get-webapplication block every subsequent write-progress?

As info:
PSVersionTable for my webserver

Name Value


PSVersion 5.1.14393.3866
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.3866
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

cls
$Computer = "SomeWebserver"

function Dummy{
    Import-Module webadministration
    Write-Progress -PercentComplete 10 -Activity "Dummy" -CurrentOperation "testing"
    Get-WebApplication
    #Get-Process
    Write-Progress -PercentComplete 20 -Activity "Dummy" -CurrentOperation "testing2"

}
$job = invoke-command -asjob -ComputerName $Computer -ScriptBlock ${Function:Dummy}
$job | Wait-Job | Receive-Job
$job.ChildJobs[0].progress
Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2021-04-12T06:38:25.347+00:00

    Hi,

    I tested the function on PowerShell 5.1 and it worked well for me.

    86688-record.gif

    Best Regards,
    Ian Xue

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.