Thursday, February 12, 2015

Wsus Fails to sync, WSUSPool stopped

So yet again here is another problem with WSUS.  These are all running on Server 2012.

Problem:
In console monitoring showed a Sync Failure.  Error code was that WSUS service was unavaiable on the box.  This affected not only the top SUP but several of the lower Secondary Servers with SUP installed.  But not all.  Yet all stopped at a certain Content Version

Troubleshooting process:
Check the WSUS service on the box: Running
Open the WSUS console (yes don't change/set anything): Unable to contact WSUS Server
Sync logs shows it can't contact the server.
Database running and working
Memory on the box was at 96.4% used
Found that in IIS the WSUS application Pool was stopped.  Restart the Pool.
After 20 mins the Pool would stop again.

wsysncmgr log on primary:

Sync failed: WSUS server not configured. Please refer to WCM.log for configuration error details.. Source: CWSyncMgr::DoSync
STATMSG: ID=6703 SEV=E LEV=M SOURCE="SMS Server" COMP="SMS_WSUS_SYNC_MANAGER" SYS=Primary.foo.com SITE=PE0 PID=1744 TID=4156 GMTDATE=Thu Feb 12 17:25:48.682 2015 ISTR0="CWSyncMgr::DoSync" ISTR1="WSUS server not configured. Please refer to WCM.log for configuration error details." ISTR2="" ISTR3="" ISTR4="" ISTR5="" ISTR6="" ISTR7="" ISTR8="" ISTR9="" NUMATTRS=0
Sync failed. Will retry in 60 minutes
Wsysctrl.log on sup
Attempting connection to local WSUS server
System.Net.WebException: The request failed with HTTP status 503: Service Unavailable.~~   at Microsoft.UpdateServices.Administration.AdminProxy.CreateUpdateServer(Object[] args)~~   at Microsoft.UpdateServices.Administration.AdminProxy.GetUpdateServer()~~   at Microsoft.SystemsManagementServer.WSUS.WSUSServer.ConnectToWSUSServer(String ServerName, Boolean UseSSL, Int32 PortNumber)
System.Net.WebException: The request failed with HTTP status 503: Service Unavailable.~~   at Microsoft.UpdateServices.Administration.AdminProxy.CreateUpdateServer(Object[] args)~~   at Microsoft.UpdateServices.Administration.AdminProxy.GetUpdateServer()~~   at Microsoft.SystemsManagementServer.WSUS.WSUSServer.ConnectToWSUSServer(String ServerName, Boolean UseSSL, Int32 PortNumber)
Failed to set WSUS Local Configuration. Will retry configuration in 1 minutes

Solution:

The 1st solution was add to a bit more ram on the VM.  This didn't solve the issue.
So I did more digging and found the Recycle Setting for IIS and Max Ram it can use:

Recycling Setting in IIS
I changed the default setting for the wsus pool from 1843200 (Kbs) and added 1GB of ram to it.  The box now seems to be happy and is syncing again.  There is not a heavy load on the box but I am watching to see what happnes.  it is odd that the twin in a differen data center isn't showing the same signs. 



Monday, January 12, 2015

WSUS for SCCM won't sync

Sometimes the most basic fix can get you over a hurdle so you can spend time fixing it instead of fighting a contanst fire:

Symptoms:

Manual Sync of WSUS from the "Update Repository" node works but the automated sync fails like such

Wsyncmgr.log:
Sync failed: The operation has timed out. Source: Microsoft.UpdateServices.Internal.ApiRemoting.ExecuteSPSearchUpdates
Sync failed. Will retry in 60 minutes

Quick Resolution:
You could manually sync the server on the schedule but that doesn't solve the problem

But why doesn't it work for the automated approach?  You may see in the console that it starts to download but never finisheds.  This could be a problem withe the SQL ram or the Server ram available.  Does it sync for the first few times after your restart your machine.  It could be the load on your site server has changed recently.

I pulled part of the script from Microsft Technet and others from my internal script base.  I then used the server Scheduled Task to kick this off for me until I could find a solid solution.


Another way would be to somehow force a script to run the manual sync for you:

Change the following names:
SITE_SERVER_NAME -> servername
SITE_CODE -> ABC


-----------------------WSYSNC.VBS-------------------------
Set swbemLocator = CreateObject("WbemScripting.SWbemLocator")
swbemLocator.Security_.AuthenticationLevel = 6 'Packet Privacy
Set swbemServices= swbemLocator.ConnectServer("SITE_SERVER_NAME", "root\sms\site_SITE_CODE")

Set context = CreateObject("WbemScripting.SWbemNamedValueSet")
'context.Add "LocaleID", "MS\1033"
'context.Add "MachineName", "SITE_SERVER_NAME "
Context.Add "SessionHandle", swbemServices.ExecMethod("SMS_SiteControlFile", "GetSessionHandle").SessionHandle
                                        

SynchronizeSoftwareUpdatePoint swbemServices,context,"SITE_CODE"

Sub SynchronizeSoftwareUpdatePoint(swbemServices,swbemContext,siteCode)
    ' Load site control file and get the SMS_WSUS_SYNC_MANAGER component section.
    swbemServices.ExecMethod "SMS_SiteControlFile.Filetype=1,Sitecode=""" & siteCode & """", "Refresh", , , swbemContext
       
    ' Calculate the current timestamp (number of seconds from 1/1/1970 to current time UTC).
    calculatedUTCOffsetinSeconds = (8 * 60 * 60)
    currentTimestamp = datediff("s", "1/1/1970 12:00:00 AM", now()) + calculatedUTCOffsetinSeconds
    currentTimestamp=currentTimestamp-7198
   
    Query = "SELECT * FROM SMS_SCI_Component " & _
            "WHERE ComponentName = 'SMS_WSUS_SYNC_MANAGER' " & _
            "AND SiteCode = '" & siteCode & "'"
   
    Set SCIComponentSet = swbemServices.ExecQuery(Query, ,wbemFlagForwardOnly Or wbemFlagReturnImmediately, swbemContext)
                      
    ' Only one instance is returned from the query.
    For Each SCIComponent In SCIComponentSet
        ' Loop through the array of embedded SMS_EmbeddedProperty instances.
        For Each vProperty In SCIComponent.Props        
                           
            ' Setting: Sync Now
            If vProperty.PropertyName = "Sync Now" Then
               
                ' Modify the value.
                vProperty.Value = currentTimestamp
      
            End If
              
        Next  
             ' Update the component in your copy of the site control file. Get the path
             ' to the updated object, which could be used later to retrieve the instance.
             Set SCICompPath = SCIComponent.Put_(wbemChangeFlagUpdateOnly, swbemContext)
    Next
                         
    ' Commit the change to the actual site control file.
    Set InParams = swbemServices.Get("SMS_SiteControlFile").Methods_("CommitSCF").InParameters.SpawnInstance_
    InParams.SiteCode = siteCode
    swbemServices.ExecMethod "SMS_SiteControlFile", "CommitSCF", InParams, , swbemContext
     
    ' Release copy of the site control file.
    swbemServices.Get("SMS_SiteControlFile").ReleaseSessionHandle swbemContext.Item("SessionHandle").Value
End Sub
----------------------
Why did I subtract time?
currentTimestamp=currentTimestamp-7198

The time is instant but I found sometimes there was a lag before it could read, so by subtracting time it makes it a future event.

Tuesday, December 30, 2014

Package missing from DP causing Task Sequence Failure

As you can see below a machine fails to run the Task Sequence.  Normally you should see the error like "ABC00001" was not found.  Here we have only the ID's of the Application.
 
Using the query below we are able to find the offending application.
/*** Script for SelectTopNRows command from SSMS  ******/
SELECT TOP 1000 [CI_ID]
      ,[PkgID]
      ,[CI_UniqueID]
      ,[SecuredTypeID]
      ,[ModelName]
  FROM [CM_CM0].[dbo].[vSMS_CIContentPackage]
  where CI_UniqueID like '%2caa%' 






CI_UniqueID



PkgIDCI_ID
138181



ABC0018DScopeId_EA3D3752-B4D4-453F-B3F3-03C70EAD781A/Application_2caa0766-569b-48c0-91b8-79bb3a22c0d7/1

Find the Application and ensure it is distributed to the DP/Secondary.