Casey
Is it possible it's just the script? When I try to run it I get an error from 
the extra '}' at the end. I'm guessing that's because this section is copied 
from a larger script, and you just included an extra '}' accidentally here.
When I run it without that script it runs fine.

Are there any entries afterwards in your UpdatesDeployment.log? If there were 
maintenance windows you would see them in the UpdatesDeployment.log, and I'm 
guessing you don't see them listed in there.

Thanks
Luke

From: [email protected] [mailto:[email protected]] On 
Behalf Of Casey Robertson
Sent: Wednesday, February 11, 2015 2:43 PM
To: [email protected]
Subject: [mssms] Powershell install of updates not working

Environment:  SCCM 2012 R2

I'm running this as part of a TS that deals with web servers behind an F5 load 
balancer.  It's all working great.  An external PS script kicks off the 
advertised TS, there is a mandatory (with future deadline) patch deployment 
target the servers and the servers appear to scan and see the applicable 
updates just fine.  Below is the code I'm using.  What frustrating is then when 
I wasn't using a TS but just doing a proof of concept by targeting the servers 
with patches and running the script against them remotely I could get the 
patches to install.  My script counter would show the applicable updates 
counting down and finishing as they got installed.  PS code at the bottom.  Of 
course I'd like to just use plain old updates deployments but I need to deal 
with an F5 load balancer so I have to have logic to check the F5, remove the 
server from the pool etc etc. before patching.

But now I get these kind of results in the logs...ideas????  No failures - it's 
like the jobs just get submitted but nothing happens.  I checked and verified 
there are no maintenance windows.  The underlying Software Update deployment is 
set to Enabled and Required with a future Installation deadline (so it just 
doesn't kick off on its own outside of my script logic).   The TS advertisement 
that calls the scripts is set as Install and Available.

UpdatesHandler.log

Initiating updates scan for checking applicability.          UpdatesHandler   
2/11/2015 12:17:21 PM    3684 (0x0E64)
Successfully initiated scan.  UpdatesHandler   2/11/2015 12:17:21 PM    3684 
(0x0E64)
Updates scan completion received, result = 0x0.             UpdatesHandler   
2/11/2015 12:17:21 PM    3684 (0x0E64)
Method (Apply) called from SDM.     UpdatesHandler   2/11/2015 12:17:22 PM    
1060 (0x0424)
Starting job with id = {7CAF7EBF-BA10-4105-92A3-999009EAEA52}       
UpdatesHandler   2/11/2015 12:17:22 PM    1060 (0x0424)
Initiating Scan. Forced = (0)                UpdatesHandler   2/11/2015 
12:17:22 PM    1060 (0x0424)
Successfully initiated scan for job ({7CAF7EBF-BA10-4105-92A3-999009EAEA52}).   
            UpdatesHandler   2/11/2015 12:17:22 PM          1060 (0x0424)
Scan completion received for job ({7CAF7EBF-BA10-4105-92A3-999009EAEA52}).      
          UpdatesHandler   2/11/2015 12:17:22 PM          1060 (0x0424)
Evaluating status of the updates for the job 
({7CAF7EBF-BA10-4105-92A3-999009EAEA52}).            UpdatesHandler   2/11/2015 
12:17:22 PM        1060 (0x0424)
Initiating download for the job ({7CAF7EBF-BA10-4105-92A3-999009EAEA52}).  
UpdatesHandler   2/11/2015 12:17:22 PM    1060 (0x0424)
Check contents availability.                UpdatesHandler   2/11/2015 12:17:22 
PM    1060 (0x0424)
Bundle update (1908f382-2a6a-466b-8957-f14888557e88) is requesting download 
from child updates for action (INSTALL)                UpdatesHandler   
2/11/2015 12:17:22 PM    1060 (0x0424)
CUpdate::CheckLocations - Checking locations on action (INSTALL) for Update 
(df7830e5-5ac4-465b-888e-473868bcb7a1)                UpdatesHandler   
2/11/2015 12:17:22 PM    1060 (0x0424)
Starting download on action (INSTALL) for Update 
(df7830e5-5ac4-465b-888e-473868bcb7a1)       UpdatesHandler   2/11/2015 
12:17:22 PM        1060 (0x0424)
Contents already available for the update 
(1d9fec3b-f1be-41f5-90a0-da36104b662d).      UpdatesHandler   2/11/2015 
12:17:22 PM          1060 (0x0424)
Contents already available for the update 
(339e2f2e-1847-4e2f-8c4f-1ae9146576ec).        UpdatesHandler   2/11/2015 
12:17:22 PM          1060 (0x0424)
Contents already available for the update 
(49593d08-5119-46e3-bfdc-2ad0ca573c6c).      UpdatesHandler   2/11/2015 
12:17:22 PM          1060 (0x0424)
Contents already available for the update 
(7b5521db-d33c-4779-8a89-2eeee9314678).    UpdatesHandler   2/11/2015 12:17:22 
PM          1060 (0x0424)
Contents already available for the update 
(876891c0-c41b-4430-aee2-608cf4e4d5ff).        UpdatesHandler   2/11/2015 
12:17:22 PM          1060 (0x0424)
Contents already available for the update 
(8f53086c-6658-4286-aa57-a9d26e5a5739).    UpdatesHandler   2/11/2015 12:17:22 
PM          1060 (0x0424)
Contents already available for the update 
(cd0139f5-252e-44e5-8b7c-2ce97a242af5).       UpdatesHandler   2/11/2015 
12:17:22 PM          1060 (0x0424)

UpdatesDeployment.log

EnumerateUpdates for action (UpdateActionInstall) - Total actionable updates = 
8                UpdatesDeploymentAgent 2/11/2015 12:17:21 PM        4004 
(0x0FA4)
InstallUpdates Initiated by user         UpdatesDeploymentAgent 2/11/2015 
12:17:21 PM    4004 (0x0FA4)
ApplyCIs - JobId = {7CAF7EBF-BA10-4105-92A3-999009EAEA52}             
UpdatesDeploymentAgent 2/11/2015 12:17:21 PM    4004 (0x0FA4)

Powershell script block:

$StartTime = Get-Date
$waitingseconds = 30

[System.Management.ManagementObject[]] $CMMissingUpdates = @(get-wmiobject 
-query "SELECT * FROM CCM_SoftwareUpdate WHERE ComplianceState = '0'" 
-namespace "ROOT\ccm\ClientSDK")
        If ($CMMissingUpdates.count) {
                Write-Host "The number of missing updates is 
$($CMMissingUpdates.count)...proceeding with installation" -ForegroundColor Red
                $CMInstallMissingUpdates = (Get-WmiObject -Namespace 
'root\ccm\clientsdk' -Class 'CCM_SoftwareUpdatesManager' 
-List).InstallUpdates($CMMissingUpdates)

        Do {
            Start-Sleep $waitingseconds
            [array]$CMInstallPendingUpdates = @(get-wmiobject -query "SELECT * 
FROM CCM_SoftwareUpdate WHERE EvaluationState = 6 or EvaluationState = 7" 
-namespace "ROOT\ccm\ClientSDK")
           Write-Host "The number of pending updates for installation is: 
$($CMInstallPendingUpdates.count)" -ForegroundColor Red
            } While (($CMInstallPendingUpdates.count -ne 0) -and ((New-TimeSpan 
-Start $StartTime -End $(Get-Date)) -lt "00:15:00"))
        }
             ELSE {
    Write-Host "There are no missing updates on $ServerName" -ForegroundColor 
Green
                  }

    }





Casey Robertson
Systems Engineer
W 619.878.9099
E [email protected]<mailto:[email protected]>

MINDBODY, Inc.
4051 Broad Street, Suite 220
San Luis Obispo, CA 93401

  [Logo-for-email-signature.jpg] <http://www.mindbodyonline.com/>



The preceding email message may be confidential or protected by the 
attorney-client privilege. It is not intended for transmission to, or receipt 
by, any unauthorized persons. If you have received this message in error, 
please (i) do not read it, (ii) reply to the sender that you received the 
message in error, and (iii) erase or destroy the message. Legal advice 
contained in the preceding message is solely for the benefit of the Foley & 
Lardner LLP client(s) represented by the Firm in the particular matter that is 
the subject of this message, and may not be relied upon by any other party.



Reply via email to