PowerShell script that will install all SCCM Software Center updates

I am looking to have a PowerShell script written that will parse the list of updates that appear within the SCCM Software Center program and will then download and install these updates.

I install Windows updates on the individual servers that I manage using the SCCM Software Center program.

The problem is that sometimes when I click the Install All button certain updates will install but other updates will initially say Failed.

I then have to wait for the updates that are currently installing to finish installing and then I have to go back and click the Install All button again to install the remaining updates.

The problem is that sometimes I have to repeat this process several times when updates continue to fail by waiting for the updates to finish installing and then clicking on the Applications tab and then clicking back on the Updates tab and clicking on the Install All button once again.

Also, the updates don't begin to download when the Software Center program says that they have failed and this causes the entire installation process to take more time to complete for the servers that are located in remote parts of the world where the updates have to be downloaded over the WAN.

What happens is that the next set of updates will begin downloading and installing and then the next set of updates in the list (that had previously failed) doesn't even begin downloading until I click on the Applications tab and then click back on the Updates tab and then click the Install All button once again.

It is too time-consuming having to repeat this process when the updates Fail.

I only have delegated administrator rights to the servers that I manage for my department and I don’t have any access to the SCCM servers. The company policy within my global organization also prohibits the updates being installed through SCCM from being required. The only way to install updates on these servers is by launching the SCCM Software Center program and manually clicking on the Install All button to install the updates.

Ideally, I would like to have this PowerShell script download all of the available updates at the same time and then install these updates in order from the oldest to the newest.

This will save me quite a bit of time so I won't have to monitor the installation status and will instead be able to use a script to complete the task of installing all of these updates for me.