Install-SCCMSoftwareUpdates Wait until finish

Hi there, I have been looking to an answer for this for a while but have as yet been unable to find one.

I am trying to use the Install-SCCMSoftwareUpdates cmdlet, however it is being used as part of a sequence of events in a script. It triggers the software updates scan and update installation correctly, however I was under the impression that this cmdlet could be configured to wait for all of the pending updates to finish before continuing.

Unfortinatly this doesn’t seem to happen. The command I am using is this:
Install-SCCMSoftwareUpdates -SoftwareUpdatesScanWaitInSeconds 600 -WaitForPendingUpdatesTimeout 18000

I thought it would wait to a max of 300 minutes for the updates to finish installing, however the cmdlet finishes the moment it triggers the update installs.

Hopefully someone can shed some light on this for me.