Gerry Hickman wrote:
> Hi Marco,
>
> Yes, you can do it from a command line. e.g. for patches that are
> already on WU/MU: Using JScript you can instantiate the Windows Update
> COM objects, you then scan the machine, filter the patch collection
> based on the patch you want to apply, then call the Download and Install
> methods, you can trap errors, check for reboot. Once you have the
> JScript, you can remote it using PsExec.
>
> My question is, how do you do this the "new way", as in PowerShell,
> .NET, etc. Interesting...
PSH> $wu=new-object -comobject microsoft.update.autoupdate
PSH> $wu|get-member
TypeName: System.__ComObject#{4a2f5c31-cfd9-410e-b7fb-29a653973a0f}
Name MemberType Definition
---- ---------- ----------
DetectNow Method void DetectNow ()
EnableService Method void EnableService ()
Pause Method void Pause ()
Resume Method void Resume ()
ShowSettingsDialog Method void ShowSettingsDialog ()
Results Property IAutomaticUpdatesResults Results () {get}
ServiceEnabled Property bool ServiceEnabled () {get}
Settings Property IAutomaticUpdatesSettings Settings () {get}
Now, you're using COM still. Unless there's a .NET library for this,
and I'd doubt it, this is the easiest way to access WU from PowerShell
very likely.
Not a fault of PowerShell if WU doesn't have other interfaces...
Marco