Powershell – How to accept EULAs for Software updates deployed through SCCM using Powershell

powershellsccm-2012updatewmi

I'm trying to use the Start-CMSoftwareUpdateDeployment cmdlet to deploy a software update group to an existing collection.

PS WHO:\> Start-CMSoftwareUpdateDeployment -SoftwareUpdateGroupName "Update Group - Microsoft Updates" -CollectionName `
Eval_OSUpdates -DeploymentType Required -SendWakeUpPacket $true -AllowRestart $true -PersistOnWriteFilterDevice $true `
-DownloadFromMicrosoftUpdate $true -DeploymentName "Evaluation Deployment - Update Group - Microsoft Updates" `
-UserNotification DisplayAll -RestartWorkstation $false -AllowUseMeteredNetwork $true

All required parameters are given, however I receive the following error upon execution:

Start-CMSoftwareUpdateDeployment : ConfigMgr Error Object:
instance of SMS_ExtendedStatus
{
    Description = "One or more updates are present for which a EULA exists which hasn't been approved.";
    ErrorCode = 1078462208;
    File = "e:\\nts_sccm_release\\sms\\siteserver\\sdk_provider\\smsprov\\sspciassignment.cpp";
    Line = 361;
    Operation = "PutInstance";
    ParameterInfo = "";
    ProviderName = "ExtnProv";
    StatusCode = 2147749889;
};
At line:1 char:1
+ Start-CMSoftwareUpdateDeployment -SoftwareUpdateGroupName "SoM Update Group - Mi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Microsoft.Confi...ploymentCommand:StartSoftwareUpdateDeploymentCommand) [Start-CMSoftware
   UpdateDeployment], WqlQueryException
    + FullyQualifiedErrorId : UnhandledExeception,Microsoft.ConfigurationManagement.Cmdlets.Sum.Commands.StartSoftwareUpdateDeployment
   Command

I'm pretty sure I know which update needed the EULA accepted, but in attempting to automate this it'd be nice to accept any EULAs programmatically and not have manual steps in the process.

I see the cmdlet Get-SoftwareUpdateLicense, but all that does is return a bloody string of the EULA, which nobody reads.

A step closer today I found an MSDN article on the AcceptEULA method, but I don't know how to call it on the update, as the update is of type SMS_SoftwareUpdate, but that method isn't listed when I pipe to Get-Member, and of course just trying to willy nilly call the method throws an error.

To summarize, that's where I'm stuck at: I don't know how to call this WMI method on a particular SMS_SoftwareUpdate object, using powershell if that makes a difference.

Best Answer

Well since nobody reads the EULA why don't you just accept them all?

Get-WmiObject -ComputerName "sccmcs" -Class SMS_SoftwareUpdate -Namespace root\sms\site_ABC | 
    where {$_.EULAExists -eq $true} |
    foreach {$_.AcceptEula($true)}

To verify you can run this before and after

Get-WmiObject -ComputerName "sccmcs" -Class SMS_SoftwareUpdate -Namespace root\sms\site_ABC | 
    where {$_.EULAExists -eq $true} | select LocalizedDisplayName, EULAExists, EULAAccepted, EULASignoffDate, EULASignoffUser | ft