Yes. You can do this with powershell similar to what the script you posted tries to do. I came across that script a while back, can't remember if it worked or not but I did get something to work. don't know why his wouldn't work, it does use the same methods, but I was able to do this with .NET and WMI using C#, so I know it can be done with powershell.
private void InstallUpdates()
{
ManagementScope sc = new ManagementScope(@"\\.\root\ccm\clientsdk");
ManagementClass c = new ManagementClass(@"CCM_SoftwareUpdatesManager");
ManagementObjectSearcher s = new ManagementObjectSearcher("SELECT * FROM CCM_SOFTWAREUPDATE WHERE COMPLIANCESTATE=0 AND EVALUATIONSTATE < 2");
c.Scope = s.Scope = sc;
ManagementObjectCollection col = s.Get();
List<ManagementObject> lUpdates = new List<ManagementObject>();
//Install each update individually and display progress
int index = 1;
//double progress = 5/10;
//progressBar1.Value = progress;
//this.Enabled = false;
foreach (ManagementObject o in col)
{
System.Management.ManagementBaseObject[] args = { o };
object[] methodArgs = { args };
c.InvokeMethod("InstallUpdates", methodArgs);
lblCurrentUpdate.Text = "Now Installing Update " + index + " of " + col.Count;
UInt32 evalState = 0;
progressBar1.Value = (int)(((index) / (double)col.Count)*100.0);
//isCompleted = false;
//backgroundWorker1.RunWorkerAsync(o);
while (evalState < 7)
{
try
{
o.Get();
evalState = (UInt32)o.Properties["EvaluationState"].Value;
}
catch (Exception ex)
{
break;
}
}
++index;
}
//this.Enabled = true;
//Restart Workstation
System.Diagnostics.Process.Start("shutdown.exe", "-r -t 0 -f");
Application.Exit();
}
In a nutshell, I used the WMI query "SELECT * FROM CCM_SOFTWAREUPDATE WHERE COMPLIANCESTATE=0 AND EVALUATIONSTATE < 2"
and passed each update one by one to the InstallUpdates method, because I wanted to display the progress similar to how Microsoft does it. You must pass an array to the InstallUpdates method, even if you're only passing a single update object. You could pass the entire returned array if you want, and it will queue them up like it always does, installing them one by one.
Also, what about configuring a maintenance window for this collection, and telling sccm not to install updates outside the maintenance window? When one update is finished, if it's past the maintenance window then it will stop installing updates (in theory for me, I've never had the maintenance window luxury).
if you're a gimmiedehcodez kinda person, that code should compile in with .NET 4.0 and
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Management;
using System.Windows.Forms;
More info on the CCMClientSDK here